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

How to use RMAN to perform a full recovery of table spaces or data files in PDB

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

Share

Shulou(Shulou.com)05/31 Report--

Editor to share with you how to use RMAN to perform full recovery of table spaces or data files in PDB. I hope you will get something after reading this article. Let's discuss it together.

Because tablespaces in different PDB can have the same name, to eliminate this confusion you must connect directly to PDB to restore PDB tablespaces. Instead, because the data file number and path name are uniquely identified across the CDB, you can connect to the root container or PDB to recover the PDB data file. If you connect to CDB's root container, you can use a single command to restore data files in multiple PDB. If you connect to the PDB, you can only restore the data files in the PDB.

Restore and restore non-SYSTEM tablespaces in PDB

1. Start RMAN and connect to the target database

[oracle@jytest1] $rman target sys/xxxxx@jypdbRecovery Manager: Release 12.2.0.1.0-Production on Mon Dec 11 17:59:27 2017Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.connected to target database: JY:JYPDB (DBID=4203494064)

two。 If the state of the database is open, then the tablespace to be restored is offline

SQL > alter tablespace test offline immediate;Tablespace altered.

3. Use the show command to see if a preset channel is configured. If the required setting type and channel are configured, no action is required. Otherwise, you can use the configure command to configure the automatic channel, or both use the run block containing the allocate channel command

RMAN > show all;RMAN configuration parameters for database with db_unique_name JY are:CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # defaultCONFIGURE BACKUP OPTIMIZATION OFF; # defaultCONFIGURE DEFAULT DEVICE TYPE TO DISK; # defaultCONFIGURE CONTROLFILE AUTOBACKUP ON; # defaultCONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO'+ test/rman_backup/%F';CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # defaultCONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # defaultCONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # defaultCONFIGURE MAXSETSIZE TO UNLIMITED; # defaultCONFIGURE ENCRYPTION FOR DATABASE OFF; # defaultCONFIGURE ENCRYPTION ALGORITHM 'AES128' # defaultCONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE' DEFAULT' OPTIMIZE FOR LOAD TRUE; # defaultCONFIGURE RMAN OUTPUT TO KEEP FOR 7 DAYS; # defaultCONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # defaultCONFIGURE SNAPSHOT CONTROLFILE NAME TO'+ test/jy/snapcf_jy.f'

4. Restore and restore tablespaces

. If you restore the data file to the original location, execute the restore tablespace and recover tablespace commands

. If you restore the data file to a new directory, execute the restore tablespace and recover tablespace commands in the run command block, and use the set newname command to rename the data file.

RMAN > restore tablespace 'TEST' Starting restore at 11-DEC-17using channel ORA_DISK_1channel ORA_DISK_1: starting datafile backup set restorechannel ORA_DISK_1: specifying datafile (s) to restore from backup setchannel ORA_DISK_1: restoring datafile 00015 to + DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/test.275.962210609channel ORA_DISK_1: reading from backup piece + TEST/rman_backup/jy_979425723_20171211_0osls830_1_1channel ORA_DISK_1: piece handle=+TEST/rman_backup/jy_979425723_20171211_0osls830_1_1 tag=TAG20171211T164446channel ORA_DISK_ 1: restored backup piece 1channel ORA_DISK_1: restore complete Elapsed time: 00:00:03Finished restore at 11-DEC-17RMAN > recover tablespace 'TEST' Starting recover at 11-DEC-17using channel ORA_DISK_1starting media recoverymedia recovery complete, elapsed time: 00:00:01Finished recover at 11-DEC-17

5. Check the output to see if the recovery is successful. Set the tablespace online if the restore is successful

RMAN > alter tablespace test online;Statement processed

Restore and restore SYSTEM tablespaces in PDB

1. Start RMAN and connect to the root container using a public user with sysdba or sysbackup privileges.

[oracle@jytest1] $rman target/ catalog rco/abcd@jypdb_173Recovery Manager: Release 12.2.0.1.0-Production on Mon Dec 11 18:11:55 2017Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.connected to target database: JY (DBID=979425723) connected to recovery catalog database

two。 Shut down CDB and restart to the mount state

SQL > conn / as sysdbaConnected.SQL > shutdown immediate;Database closed.Database dismounted.ORACLE instance shut down.SQL > startup mountORACLE instance started.Total System Global Area 6442450944 bytesFixed Size 8807168 bytesVariable Size 1895828736 bytesDatabase Buffers 4529848320 bytesRedo Buffers 7966720 bytesDatabase mounted.

3. Restore and restore the data files of SYSTEM tablespaces in PDB

[oracle@jytest1] $rman target/ catalog rco/abcd@jypdb_173Recovery Manager: Release 12.2.0.1.0-Production on Mon Dec 11 18:20:30 2017Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.connected to target database: JY (DBID=979425723, not open) connected to recovery catalog databaseRMAN > report schema Starting full resync of recovery catalogfull resync completeReport of database schema for database with db_unique_name JYList of Permanent Datafiles==File Size (MB) Tablespace RB segs Datafile Name-----1830 SYSTEM YES + DATA/JY/DATAFILE/system.317.9622096033 1230 SYSAUX NO + DATA/JY/DATAFILE/sysaux.298.9622096054 75 UNDOTBS1 YES + DATA/JY/DATAFILE/undotbs1.277.9622096055 250PDB$SEED:SYSTEM NO + DATA/JY/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/system.256.9622096756 340 PDB$SEED:SYSAUX NO + DATA/JY/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/sysaux.270.9622096757 5 USERS NO + DATA/JY/DATAFILE/users.301.9622096058 100PDB$SEED:UNDOTBS1 NO + DATA/JY/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/undotbs1.296.9622096759 50 UNDOTBS2 YES + DATA/JY/DATAFILE/undotbs2.312.96220960510 260JYPDB:SYSTEM YES + DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/system.271.96220964911 460JYPDB:SYSAUX NO + DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/sysaux .316.96220964912 100 JYPDB:UNDOTBS1 YES + DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/undotbs1.264.96220964913 100 JYPDB:UNDO_2 YES + DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/undo_2.268.96220964914 5 JYPDB:USERS NO + DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/users.278.96220964915 100 JYPDB:TEST NO + DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/test.275.96221060916 260 TESTPDB:SYSTEM YES + DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/system.260.96246940917 460TESTPDB:SYSAUX NO + DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/sysaux.259.96246940918 100TESTPDB:UNDOTBS1 YES + DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/undotbs1.265.96246940919 100TESTPDB:UNDO_2 YES + DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/undo_2.266.96246940920 5 TESTPDB:USERS NO + DATA/ JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/users.267.96246940921 100 TESTPDB:TEST NO + DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/test.269.962469409List of Temporary Files===File Size (MB) Tablespace Maxsize (MB) Tempfile Name -1142 TEMP 32767 + DATA/JY/TEMPFILE/temp.299.9619763392 64 PDB$SEED:TEMP 32767 + DATA/JY/5F9AA264B21F3ED9E053AB828A0A6088/TEMPFILE/temp.297.9622098653 135JYPDB:TEMP 32767 + DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/TEMPFILE/temp.276.9622105194 135TESTPDB:TEMP 32767 + DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/TEMPFILE/temp.258.962469435RMAN > restore tablespace 'JYPDB:SYSTEM' Starting restore at 11-DEC-17allocated channel: ORA_DISK_1channel ORA_DISK_1: SID=10 instance=jy1 device type=DISKRMAN-00571: = = RMAN-00569: = ERROR MESSAGE STACK FOLLOWS = RMAN-00571: = = RMAN-03002: failure of restore command at 12 + 11 failure of restore command at 2017 18:21:09RMAN-06004: ORACLE error from recovery catalog database: RMAN-20202: Tablespace not found in the recovery catalogRMAN-06019: could not translate tablespace name "JYPDB:SYSTEM"

Here, there will be an error when using the tablespace name when restoring SYSTEM tablespaces. If you use restore datafile and recover datafile methods to restore and restore SYSTEM tablespaces

RMAN > restore datafile 10 Starting restore at 11-DEC-17using channel ORA_DISK_1channel ORA_DISK_1: starting datafile backup set restorechannel ORA_DISK_1: specifying datafile (s) to restore from backup setchannel ORA_DISK_1: restoring datafile 00010 to + DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/system.271.962209649channel ORA_DISK_1: reading from backup piece + TEST/rman_backup/jy_979425723_20171211_0osls830_1_1channel ORA_DISK_1: piece handle=+TEST/rman_backup/jy_979425723_20171211_0osls830_1_1 tag=TAG20171211T164446channel ORA_DISK_ 1: restored backup piece 1channel ORA_DISK_1: restore complete Elapsed time: 00:00:15Finished restore at 11-DEC-17RMAN > recover datafile 10 Starting recover at 11-DEC-17using channel ORA_DISK_1starting media recoverymedia recovery complete, elapsed time: 00:00:01Finished recover at 11-DEC-17

4. Open all PDB in CDB

RMAN > alter database open;Statement processedstarting full resync of recovery catalogfull resync completeRMAN > alter pluggable database all open read write;Statement processedstarting full resync of recovery catalogfull resync complete after reading this article, I believe you have some understanding of "how to use RMAN to perform full recovery of table spaces or data files in PDB". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!

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