Before running the setup script, you should be aware of the following requirements:
The database user who runs the setup script is expected to be the same one used to update the MobiLink system tables during synchronization. This user must be used to start the MobiLink server and to configure MobiLink applications. See Required privileges.
The RDBMS user that the MobiLink server uses to connect to the consolidated database must be able to use the MobiLink system tables, procedures, and so on, without any qualifiers (for example, SELECT * from ml_user).
The RDBMS user must also have SELECT privilege on GV$TRANSACTION, GV$SESSION, GV$LOCK, and DBA_OBJECTS, and EXECUTE privileges on DBMS_UTILITY. You cannot grant permission directly for the GV$TRANSACTION, GV$SESSION and GV$LOCK synonyms; you must instead grant permission on the underlying GV_$TRANSACTION, GV_$SESSION, and GV_$LOCK dynamic performance views. You must connect as SYS to grant this access. The Oracle syntax for granting this access is:
grant select on SYS.GV_$TRANSACTION to user-name; |
grant select on SYS.GV_$SESSION to user-name; |
grant select on SYS.GV_$LOCK to user-name; |
grant execute on SYS.DBMS_UTILITY to user-name; |
To set up Oracle to work as a MobiLink consolidated database, you must run a setup procedure that adds MobiLink system tables, stored procedures, triggers, and views that are required for MobiLink synchronization. There are multiple ways you can do this:
Run the syncora.sql setup script, located in %SQLANY16%\MobiLink\Setup.
Check and update the MobiLink system setup from Sybase Central. See MobiLink system setup.
You must set up an ODBC DSN for your Oracle consolidated database. See:
MobiLink synchronization and timestamp-based downloads with an Oracle Real Application Cluster Rows in the consolidated database running on an Oracle RAC may be missed if the clocks of the Oracle cluster nodes differ by more than the time elapsed between the MobiLink server fetching the next last download timestamp and fetching the rows to be downloaded. This problem is unlikely on a RAC system with synchronized node clocks, but the likelihood increases with larger node clock differences. A workaround is to create either a modify_next_last_download_timestamp or modify_last_download_timestamp script to subtract the maximum node clock difference.
At least since version 10i, Oracle has recommended using Network Time Protocol (NTP) to synchronize the clocks on all nodes in a cluster. NTP typically runs by default on Unix and Linux. With cluster nodes properly configured to use NTP, their clocks should all be within 200 microseconds to 10 milliseconds (depending on the proximity of the NTP server). Since Windows Server 2003, the Windows Time Service implements the NTP version 3 protocol which runs by default. Also, as of version 11gR2, Oracle Clusterware includes the Oracle Cluster Time Synchronization Service (CTSS) to either monitor clock synchronization or, if neither NTP or Windows Time Service is running, to actively maintain clock synchronization. However, CTSS and Windows Time Service are less accurate than NTP.
To avoid missing rows when Oracle RAC node clocks differ by up to one second more than the time between fetching the next_last_download_timestamp and the rows to be downloaded, the MobiLink server subtracts one second from the next_last_download_timestamp fetched from the consolidated database if the following are true:
the Oracle account used by the MobiLink server has execute privilege for SYS.DBMS_UTILITY
the consolidated database is an Oracle RAC system
for MobiLink versions 12.0.0 and up, there is no generate_next_last_download_timestamp script
For Oracle RAC node clocks that may differ by greater amounts, you can avoid the problem by defining a generate_next_last_download_timestamp, modify_next_last_download_timestamp or modify_last_download_timestamp script to compensate for the maximum node clock difference.
Data type mapping The data types of columns must map correctly between your consolidated and remote database. For details, see Oracle data mapping.
XMLTYPE data type Use of the Oracle XMLTYPE data type with SQL Anywhere or UltraLite requires special care. For details, see Oracle XMLTYPE data type.
CHAR columns In Oracle, CHAR data types are fixed length and blank-padded to the full length of the string. In MobiLink remote databases (SQL Anywhere or UltraLite), CHAR is the same as VARCHAR: values are not blank-padded to a fixed width. It is strongly recommended that you use VARCHAR in the consolidated database rather than CHAR. If you must use CHAR, the mlsrv16 -b command line option can be used to remove trailing blanks from strings during synchronization. This option is important for string comparisons used to detect conflicts.
See -b mlsrv16 option.
Timestamps The MobiLink server uses gv$transaction to generate a timestamp for the remote database to be used in the next synchronization, so the MobiLink server login ID must have a SELECT privilege on gv$transaction. Oracle does not allow you to grant access to gv$transaction directly; you must instead grant SELECT privilege on the underlying gv_$transaction view. See Privileges.
Stored procedures If you are using stored procedures to return result sets or accept VARRAY parameters, you must select the Procedure returns results or uses VARRAY parameters option for the SQL Anywhere 16 - Oracle ODBC driver. Also, Sybase Central requires procedures to return results to use central administration of remote databases, so this option needs to be selected when using central administration.
Session-wide variables You can store session-wide information in variables within Oracle packages. Oracle packages allow variables to be created, modified and destroyed; these variables may last as long as the Oracle package is current.
Autoincrement methods To maintain primary key uniqueness, you can use an Oracle sequence to generate a list of keys similar to that of a SQL Anywhere autoincrement field. The CustDB sample database provides coding examples, which can be found in Samples\MobiLink\CustDB\custora.sql. Unlike autoincrement, however, you must explicitly reference the sequence. SQL Anywhere autoincrement inserts a column value automatically if the column is not referenced in an INSERT statement.
Oracle does not support empty strings In Oracle, an empty string is treated as null. In SQL Anywhere and UltraLite, empty strings have a different meaning from null. Therefore, you should avoid using empty strings in your client databases when you have an Oracle consolidated database.
The Oracle XMLTYPE data type can be mapped to the SQL Anywhere XML data type or the UltraLite LONG VARCHAR or VARCHAR(n) data types. It is important to be aware that the Oracle database server validates the data before storing it into an XMLTYPE column but SQL Anywhere and UltraLite do not, so you must ensure that XML documents to be uploaded contain valid XML.
Small XML documents with a length of less than or equal to 32 KB can be uploaded into and downloaded from an Oracle database with Oracle PL/SQL statements. When the length of XML documents is greater than 32 KB, the upload XML documents may need to be uploaded into a global temporary table using the upload_insert and upload_update scripts. The upload data can then be converted and stored into the actual synchronization table using the end_upload_rows or end_upload script.
The following examples provide sample upload and download scripts to upload and download XMLTYPE objects between an Oracle consolidated database and SQL Anywhere remote databases. In these examples, the upload table is defined in the Oracle consolidated database as:
create table test (pk int not null primary key, c1 XMLTYPE) |
The upload table is defined in the SQL Anywhere remote database as:
create table test (pk int not null primary key, c1 XML) |
When all XML documents are less than or equal to 32KB long, the upload and download scripts can be written as follows upload_insert
declare v_pk integer; v_c1 clob; x_c1 xmltype; begin v_pk := {ml r.pk}; v_c1 := {ml r.c1}; x_c1 := XMLTYPE.createXML( v_c1 ); insert into test values( v_pk, x_c1 ); end; |
download_cursor
select pk, XMLSERIALIZE( content c1 ) from test |
This upload_insert script works well when the XML data length is less than or equal to 32 KB. However, if the XML data length is greater than 32 KB, the Oracle server may issue an error.
If there are any XML documents greater than 32 KB long, the upload XML data needs to be uploaded in a global temporary table The upload_insert script uploads the XML documents into a global temporary table in the Oracle consolidated database. The global temporary table is defined as:
create global temporary table tmp_test (pk int, c1 CLOB) |
Then the upload_insert script can written as follows:
insert into tmp_test values( {ml r.pk}, {ml r.c1} ) |
The c1 column in the temporary table must have the CLOB data type.
The end_upload_rows script retrieves the XML documents from the global temporary table, converts them to XML documents, and then stores the XML data into the test table. Following is the end_upload_rows script:
insert into test (pk, c1) (select pk, XMLTYPE.createXML(c1) from tmp_test |
![]() |
Discuss this page in DocCommentXchange.
|
Copyright © 2014, SAP AG or an SAP affiliate company. - SAP Sybase SQL Anywhere 16.0 |