An Oracle Database snapshot is a table that contains query results for one or more tables or views on a local or remote database. That is to say, the basic principle of a snapshot is to save a query result from a local or remote database in a table.
The following is my snapshot, which is used to copy data from the business database to the processing database. It is a copy of data between two different servers.
Step 1: Create a database link on the Oracle terminal on the processing server. The SID of the Business Database Server is test.
Create database link test_dblink.us.oracle.com
Connect to amicos identified by amicos
Using 'test ';
Step 2: Create a snapshot log for the table corresponding to the Business Database
Create snapshot log on a_table;
Step 3: Create a snapshot named test_snapshot
Create snapshot test_snapshot
Refresh complete start with sysdate next sysdate + 1/24
As select * From a_table @ test_dblink
Note: refresh is a refresh method.
There are two refresh Methods: complete and fast, and start with indicates the start time of execution.
Next is the next execution time.
In the future, as is the method for querying snapshots.
Related methods:
Change Snapshot
Alter snapshot test_snapshot
Refresh complete start with sysdate next sysdate + 1/2;
Manually refresh the snapshot and execute the following command on the command interface:
Exec dbms_snapshot.refresh ('test _ snapshot ', 'C ');
The first parameter is the snapshot name to be refreshed.
The second parameter is the refresh method, F----FAST, C---COMPLETE
View the last refresh date of the snapshot
Select name, last_refresh
From all_snapshot_refresh_times;
The final solution is as follows:
1: Create a snapshot log for the table to be Snapshot
Create snapshot log on T1 with rowid; here we use rowid to create the parameter of the log.
2. Create a snapshot using fast and use rowid as the reference parameter.
Create snapshot fb_test_ B refresh fast with rowid start with sysdate next sysdate + 1/1440 as select * From fb_test_ B @ my_dblink;
It is best to create a snapshot Based on rowid. Otherwise, you must create a primary key for the table.