You are on page 1of 4

SAP Note

518241 - DB Connect in BW for an external Oracle database


Version 14 Validity: 22.09.2010 - active

Language English

Header Data
Released On
Release Status
Component

22.09.2010 11:43:20
Released for Customer
BW-SYS-DB-ORA BW ORACLE

Other Components BW-WHM-DST-DBC DB Connect


Priority
Category

Correction with high priority


Consulting

Symptom
You want to import data from an external Oracle database into your BW 3.X system or higher.
To do this, you can use the external Database Connect to connect the external database to a BW
release as the source system.
BW 3.X stands for BW 3.0, BW 3.1 and BW 3.5 or higher.
The words "or higher" here mean versions with version numbers (to the left of the decimal point)
higher than 3 (for example, BW 7 or higher) because in other (DB-relevant) parts, all 3 (or more)
versions are based on the same code.
The following note describes

the prerequisites to note in your environment,

the problems that may occur (and have occurred) and...

how to solve them (where possible).

The note is updated with findings, tips and tricks and the latest problems (as well as their
solution) as they arise.
Version September 22, 2010

Other Terms
RSDBC, DBCON, DBCONNECT, multiconnect, source system database, DataSource, InfoSource

Reason and Prerequisites


l

General information

The above function allows you to load data from an external Oracle database (not a BW database) into
your BW system.
There may also be constellations which cannot be used directly through the DB Connect access.
However, it should be possible to find an adequate, customer-specific solution for most of these
scenarios.
In such situations, the resulting work falls into the area of Consulting and cannot be handled via
Support (AGS/IMS).
Successful implementation of a connection requires corresponding expertise and experience in the use
of the source database in the areas:
- Tools
- SQL syntax
- DB-specific functions
Corresponding knowledge of the source application is also required to ensure that semantically
relevant data arrives in the BW system.
l

Procedure

You should execute the following steps to connect the source system (Q) to the BW system (BW):

Installing the client software on an BW application server

You only need to install the client software if you are using BW with a nonOracle database. If you use a non-Oracle BW system, you must also copy the dbsoraslib library to the
BW run directory, so that the underlying kernel finds the Oracle libraries.
Use the Oracle setup program on the database CD (runInstaller on Unix) to start

the OracleInstaller. Follow the program instructions and the DB installation instructions to install
the Oracle Client software on BW.
Of course, you can also use the "Oracle Instant Client" that has existed since
Oracle 10g. Since this is a BW note, refer to Note 998004 (Windows) or 819829 (Unix) and other notes
regarding the installation of or the upgrade to the "Oracle Instant Client".

Testing connection setup from BW to Q

After you install the client software on BW, try to set up a connection from BW
to the server on Q. You may need to adjust the tnsnames.ora or sqlnet.ora files for this, to
introduce the Oracle systems (to which contact should be made) to BW. You can test the connection by
executing the command "tnsping QDB" on BW to check whether the client has established contact to the
QDB database on the Q system.

Creating a separate U user in Q

We recommend that you create a separate U user in Q for connection to BW. This
means that authorization and administration questions can be solved centrally.

Displaying data sources in Q for the U user

To provide U data for users other than U, you can create views on other user
tables as user U:
CREATE OR REPLACE VIEW viewname AS
SELECT * FROM QDB.tablename
You may have to grant SELECT privileges to user U in the QDB schema:
GRANT select ON QDB.tablename TO U
You can also restrict or reformat data in the view arrangement (for example,
change from internal date format into the SAP date format). JOIN operations using several tables are
also available.

!!! Synonyms do not work.


Synonyms that you can create as described below are another option for providing
a complete table for the user U:
CREATE SYNONYM synoname FOR QDB.tablename
Since BW does not support synonyms, you must use a view that reads the data
using the synonym.
CREATE OR REPLACE VIEW synoviewname AS
SELECT * FROM QDB.synoname
or create a view over the table.
!!! Synonyms do not work.

After you have displayed the required data for user U, you can simply use
SELECT * FROM <view or table>
on the Q system to check which data is returned.

You can now open a link to Q as user U in the BW system with SQLPLUS and check,
using the same SELECT, whether this data is also seen in the Oracle client. If this is not the case,
there is probably a connection problem.

Creating a connection from BW to Q in BW

Including data sources of user U user in Q in BW.

Solution
l

Supported BW, Basis and database versions


BW 3.0BBasis 6.20 SP2 (or higher, see above)
Oracle 8.1 (or higher, see above and see below)
Possible problems

- Synonyms do not (yet) work.


Up to now, only tables and views have been used as data sources for the DB Connect from the R3
Basis. As soon as synonyms are also used in the Basis, you will be able to convert created views (or
even replicated tables) to synonyms as a workaround.
With Basis 6.40 at the earliest, therefore as of BW 3.5, you will also be able to use synonyms.
Until then, the following will help:
CREATE VIEW <view_on_synonym> AS SELECT * FROM <synonym>
20.10.2006: Synonyms are not supported in general.
- The source DB must have at least the release version of the BW DB.

Oracle only ensures the support of client-server links if the version of the client is not higher
than that of the server. If BW has Oracle Version 8.1 (this is an EXAMPLE, for higher versions it
must be interpreted accordingly with other Oracle release numbers) and, as is the case for DB
Connect, is run as the server against the server of the source database, the source database must
have at least release level Oracle 8.1 or higher.
Of course, you have the option to install the Oracle client software of a lower version and then use
this for the DB connect. This is also the procedure used to work with a DB connect on external
databases of other vendors.
Furthermore, the implementation of the DBconnect function in BW uses SAP Basis functions.
Specifications of the Oracle database catalog as of Version 8.1 are used. The source database must
therefore have at least Version 8.1. In this EXAMPLE, the version numbers must also be interpreted
accordingly when releasing and using higher versions.
- Oracle Client Software Version
If you want to connect from an Oracle BW DB to an Oracle source DB, for the DB connect you naturally
use the client software that you already installed on each application server.
If you want to connect from a non-Oracle BW DB to an Oracle source DB, check item 3 of note 521230
to see which Oracle client software version is released with your BW R3 kernel and use this version.
Note 521230 also contains information for Oracle releases higher than 9i.
- Date and time fields in Oracle and converting them into
SAP-compatible column formats
Example with a DATE field:
Since a SAP table does not have a DATE field (date values are NUMC(8) and time specifications are
NUMC(6)), we will use the Oracle DBA_TABLES system table as an example.
SQL> desc dba_tables;
The Oracle DBA_TABLES table has a LAST_ANALYZED field. This is a DATE type field and DBA_CONNECT
recognizes it as a date field of 7 characters. However, the import does not work because the DATE is
a 7-byte conglomerate of "...century, year, month, date, hour, minute and second." (extract from the
Oracle documentation).
To make this DATE field legible for DB connect, you must use the TO_CHAR function in a VIEW. This
should display the following examples:
SQL> selectLAST_ANALYZED from dba_tables
where table_name like 'RS%' and rownum < 10 ;
The formatting used here is the default formatting used implicitly by SQLPLUS.
SQL> selectto_char(LAST_ANALYZED,'YYYYMMDD') as dat from dba_tables
where table_name like 'RS%' and rownum < 10 ;
The result now has the SAP compatible format YYYYMMDD and should be loaded correctly by the DB
Connect as the date.
SQL> selectto_char(LAST_ANALYZED,'HH24MISS') as tim from dba_tables
where table_name like 'RS%' and rownum < 10 ;
The result now has the SAP compatible format HHMMSS and should be loaded correctly by the DB Connect
as the time.
You can use the following example for more detailed experiments:
SQL> select to_char(
TO_DATE('03-FEB-2001 04:05:06','DD-MON-YYYY HH24:MI:SS'),
'YY-MM-DD HH24-MI-SS') as datim from dual;
with the result:
DATIM
----------------01-02-03 04-05-06
When you create a VIEW and use the TO_CHAR function (or other functions), you should easily be able
to avoid problems with the interpretation of date/time specifications (and other reformatting).
Details about the functions and the formats are contained in the Oracle documentation.
- Special characters
A words that contain special characters can only be imported correctly if the code pages in BW and
in the source system are identical. If the code pages are not the same, DB Connect can be used if
the characters to be imported appear under the first 127 characters of the character set.
The use of multibyte code pages in the source system for saving data using character sets with more
than 256 characters (Kanji, Katakana, Hiragana, Korean, Chinese, Tagalog, Khmer, Arabic, Cherokee,
and so on) can cause the characters to become corrupt.
For questions concerning the code pages, refer to question/answer 19 in the FAQ Note 606359.

Validity
Software Component From Rel. To Rel. And Subsequent
SAP_BW
30A
30B

References
This document refers to:
SAP Notes
606359 FAQ: Oracle National Language Support (NLS)
521230 FAQ: Client software 9i or lower on UNIX
339092 DB MultiConnect with Oracle as secondary database
323151 Several DB connections with Native SQL

This document is referenced by:


SAP Notes (4)
339092 DB MultiConnect with Oracle as secondary database
323151 Several DB connections with Native SQL
521230 FAQ: Client software 9i or lower on UNIX
606359 FAQ: Oracle National Language Support (NLS)