Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Oracle 12c Refreshable Clone

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This example will introduce the creation of a target PDB (ycpdb) by cloning a remote PDB (jypdb). This clone is a refreshable copy of the source PDB, which means that any changes made to the source PDB can be refreshed to update the target PDB. It is assumed that the following conditions are met:

. The dblink connected to the remote PDB (jypdb) is jypdb_link

. Do not use the path_ prefix clause

. Do not use the file_name_convert and create_file_ clauses, if OMF is enabled or the pdb_file_name_convert parameter is set. Then based on OMF or parameter settings

The file will be copied to the newly specified directory

. No storage restrictions are used for PBD. Therefore, do not use the storage clause

. There is no file with the same name as the new temp file, so the new temp file is created in the target directory. Therefore, you do not need to specify the tempfile reuse clause.

. Refresh the clone will automatically refresh every 10 minutes. Remember, in order to create a refreshable PDB, the source PDB must enable both archivelog mode and native undo mode.

1. Create a dblink pointing to the source PBD (jypdb) in the target database CDB (jy)

SQL > create public database link jypdb_link 2 connect to system identified by "cs" 3 using'(DESCRIPTION = 4 (ADDRESS_LIST = 5 (ADDRESS = (PROTOCOL = TCP) (HOST = 10.10.13.17) (PORT = 1521)) 6) 7 (CONNECT_DATA = 8 (SERVER = DEDICATED) 9 (SERVICE_NAME = jypdb) 10) 11'; Database link created

two。 Check whether the source pdb enables arachivelog and local undo

SQL > col PROPERTY_NAME for a25th SQL > col PROPERTY_VALUE for a25th SQL > select PROPERTY_NAME,PROPERTY_VALUE from database_properties where property_name='LOCAL_UNDO_ENABLED' PROPERTY_NAME PROPERTY_VALUE--LOCAL_UNDO_ENABLED TRUESQL > archive log listDatabase log mode Archive ModeAutomatic archival EnabledArchive destination + DATA/archOldest online log sequence 251Next log sequence to archive 253Current log sequence 253

3. Execute the following statement in the target database CDB (jy) to clone the refreshable PDB

SQL > create pluggable database ycpdb from jypdb@jypdb_link refresh mode every 10 minutes;Pluggable database created.

4. Insert and delete data on tables jy.jy_test and jy.test in the source database

SQL > select * from jy.jy_test; USER_ID- 2 1SQL > select * from jy.test; USER_ID- 2 1SQL > insert into jy.jy_test values (3); 1 row created.SQL > commit;Commit complete.SQL > delete from jy.test where rownum commit;Commit complete.SQL > host dateFri Aug 25 01:58:40 CST 2017

5. Ten minutes later, we query the target database ycpdb to see if the data has been refreshed to the target database ycpdb.

5.1Open pdb (ycpdb) in read only mode first

SQL > select name,open_mode from vault pdbs / NAMEFUR / Modi > alter pluggable database ycpdb open read only;Pluggable database altered.

5.2 to see if the data has been refreshed, you can see from the results below that the data has been refreshed.

SQL > select * from jy.jy_test; USER_ID- 2 3 1SQL > select * from jy.test; USER_ID- 1

6. To synchronize with the source pdb (jypdb), we need to set the target pdb to close state

SQL > alter pluggable database ycpdb close immediate;Pluggable database altered.SQL > select name,open_mode from vanguard pdbsNAMEMurray, Murray, Musi, OPENMODEMUR, YCPDBMOUNTED

We can also manually refresh the target pdb

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report