Database Synchronization is often used in the project process. Now, we paste the synchronization process of a project that was previously created for your reference!
This document is completed in the following steps:
1. Environment configuration (establish a connection between SQL and oracle)
2. Write stored procedures and job scheduled tasks
3. Data Synchronization
(1) Environment Configuration
1.1 configure SQL connection to oracle
1.1.1 link Server Object Configuration
After logging on to SQL, right-click "Server Object"> "link server" and choose "New link server", as shown in:
1.1.2 general configuration
After step 1 is configured, select general, as shown in:
Click OK to save the configuration.
1.1.3 Security Configuration
After completing step 2, select security, as shown in:
[Security] After the configuration is complete, click [OK] to save.
1.2 test Link Configuration
After the link Server Object is configured, perform the following tests to check whether the configuration is correct!
1.2.1 open the query panel
Select database> InLeeData> New query node.
Note: [InLeeData] indicates the name of the database used on site.
As shown in:
1.2.2 write test statements
Select * from openquery (smart, select * from smart_personnel)
As a test example
(2) writing a stored procedure
Reference attachment (1. Stored Procedure script, 2. scheduled task script)
(3) Data Synchronization
1.1 perform the following operations in the apartment management system:
1.1.1 execute the Stored Procedure script
1. Open the "1. Apartment staff synchronization script. SQL" file.
2. In the edit script area, Run "1. Synchronize the script. SQL.
1.1.2 Execution Plan Task
1. Open the 2. task. SQL file.
In the open edit script area, modify the Database User Name:
Find the following statement:
@ Database_name = N smart_bgs_menjin,
Change smart_bgs_menjin to the name of the on-site SQL database
2. Execute "2. task. SQL.
1.1.3 start a scheduled task
Prerequisites: the stored procedure and task plan are correctly executed.
Select "SQL Server proxy"> "job"> "Task" and select "start job", as shown in:
Only some steps are provided for confidentiality reasons. For reference only.