sys@ORA12C> selectname, recovery_status from v$pdbs;
NAME RECOVERY -------------------------------------------------------------------------------------------------------------------------------- -------- PDB$SEED ENABLED PDB12C ENABLED PDB2 DISABLED
查看数据文件的状态
1 2 3 4 5 6 7 8 9 10 11
sys@ORA12C> alter session set container=pdb2;
Session altered.
sys@ORA12C> col name for a80 sys@ORA12C> select name, status from v$datafile; NAMESTATUS --------------------------------------------------------------------------------------- /u01/app/oracle/product/12.2.0/dbhome_1/dbs/UNNAMED00016SYSOFF /u01/app/oracle/product/12.2.0/dbhome_1/dbs/UNNAMED00017RECOVER /u01/app/oracle/product/12.2.0/dbhome_1/dbs/UNNAMED00018RECOVER
尝试打开PDB2
1 2 3 4 5
sys@ORA12C> alter pluggable database pdb2 open; alter pluggable database pdb2 open * ERROR at line1: ORA-01111: namefor data file 16is unknown - renameto correct file
PDB2(4):Datafile 13 added to flashback set PDB2(4):Successfully added datafile 13 to media recovery PDB2(4):Datafile #13: '/u01/app/oracle/oradata/ORA12C_DG/874155556D1A9CB6E0536892A8C0B4D1/datafile/o1_mf_system_gczyjjms_.dbf' 2019-04-24T13:55:23.737483+08:00 Recovery copied files for tablespace SYSAUX Recovery successfully copied file /u01/app/oracle/oradata/ORA12C_DG/874155556D1A9CB6E0536892A8C0B4D1/datafile/o1_mf_sysaux_gczyjjnf_.dbf from /u01/app/oracle/oradata/ORA12C_DG/86DF1439DC9B8E60E0536892A8C0ECA0/datafile/o1_mf_sysaux_gcxbqyr5_.dbf PDB2(4):Datafile 14 added to flashback set PDB2(4):Successfully added datafile 14 to media recovery PDB2(4):Datafile #14: '/u01/app/oracle/oradata/ORA12C_DG/874155556D1A9CB6E0536892A8C0B4D1/datafile/o1_mf_sysaux_gczyjjnf_.dbf' 2019-04-24T13:55:25.426806+08:00 Recovery copied files for tablespace UNDOTBS1 Recovery successfully copied file /u01/app/oracle/oradata/ORA12C_DG/874155556D1A9CB6E0536892A8C0B4D1/datafile/o1_mf_undotbs1_gczyjjnf_.dbf from /u01/app/oracle/oradata/ORA12C_DG/86DF1439DC9B8E60E0536892A8C0ECA0/datafile/o1_mf_undotbs1_gcxbsf50_.dbf PDB2(4):Datafile 15 added to flashback set PDB2(4):Successfully added datafile 15 to media recovery PDB2(4):Datafile #15: '/u01/app/oracle/oradata/ORA12C_DG/874155556D1A9CB6E0536892A8C0B4D1/datafile/o1_mf_undotbs1_gczyjjnf_.dbf' 2019-04-24T13:55:27.687506+08:00 Buffer Cache Full DB Caching mode changing from FULL CACHING ENABLED to FULL CACHING DISABLED Full DB Caching disabled: DEFAULT_CACHE_SIZE should be at least 70 MBs bigger than current size. 2019-04-24T13:56:40.020461+08:00 PDB2(4):Recovery dropped temporary tablespace 'TEMP' PDB2(4):Recovery deleting file #15:'/u01/app/oracle/oradata/ORA12C_DG/874155556D1A9CB6E0536892A8C0B4D1/datafile/o1_mf_undotbs1_gczyjjnf_.dbf' from controlfile. PDB2(4):Deleted Oracle managed file /u01/app/oracle/oradata/ORA12C_DG/874155556D1A9CB6E0536892A8C0B4D1/datafile/o1_mf_undotbs1_gczyjjnf_.dbf PDB2(4):Recovery dropped tablespace 'UNDOTBS1' PDB2(4):Recovery deleting file #14:'/u01/app/oracle/oradata/ORA12C_DG/874155556D1A9CB6E0536892A8C0B4D1/datafile/o1_mf_sysaux_gczyjjnf_.dbf' from controlfile. PDB2(4):Deleted Oracle managed file /u01/app/oracle/oradata/ORA12C_DG/874155556D1A9CB6E0536892A8C0B4D1/datafile/o1_mf_sysaux_gczyjjnf_.dbf 2019-04-24T13:56:41.232472+08:00 PDB2(4):Recovery dropped tablespace 'SYSAUX' PDB2(4):Recovery deleting file #13:'/u01/app/oracle/oradata/ORA12C_DG/874155556D1A9CB6E0536892A8C0B4D1/datafile/o1_mf_system_gczyjjms_.dbf' from controlfile. PDB2(4):Deleted Oracle managed file /u01/app/oracle/oradata/ORA12C_DG/874155556D1A9CB6E0536892A8C0B4D1/datafile/o1_mf_system_gczyjjms_.dbf PDB2(4):Recovery dropped tablespace 'SYSTEM' PDB2(4):Recovery dropped pluggable database 'PDB2' 2019-04-24T13:56:43.248383+08:00 Buffer Cache Full DB Caching mode changing from FULL CACHING DISABLED to FULL CACHING ENABLED 2019-04-24T13:58:13.327411+08:00 Recovery created pluggable database PDB2 PDB2(5):File copy for ts-SYSTEM skipped for excluded/offline tablespace PDB2(5):File #16 added to control file as 'UNNAMED00016'. Originally created as: PDB2(5):'/u01/app/oracle/oradata/ORA12C/874155556D1B9CB6E0536892A8C0B4D1/datafile/o1_mf_system_gczyo7v3_.dbf' PDB2(5):because the pluggable database was created with nostandby PDB2(5):or the tablespace belonging to the pluggable database is PDB2(5):offline. 2019-04-24T13:58:14.710452+08:00 PDB2(5):File copy for ts-SYSAUX skipped for excluded/offline tablespace PDB2(5):File #17 added to control file as 'UNNAMED00017'. Originally created as: PDB2(5):'/u01/app/oracle/oradata/ORA12C/874155556D1B9CB6E0536892A8C0B4D1/datafile/o1_mf_sysaux_gczyo7v3_.dbf' PDB2(5):because the pluggable database was created with nostandby PDB2(5):or the tablespace belonging to the pluggable database is PDB2(5):offline. 2019-04-24T13:58:15.722284+08:00 PDB2(5):File copy for ts-UNDOTBS1 skipped for excluded/offline tablespace PDB2(5):File #18 added to control file as 'UNNAMED00018'. Originally created as: PDB2(5):'/u01/app/oracle/oradata/ORA12C/874155556D1B9CB6E0536892A8C0B4D1/datafile/o1_mf_undotbs1_gczyo7v4_.dbf' PDB2(5):because the pluggable database was created with nostandby PDB2(5):or the tablespace belonging to the pluggable database is PDB2(5):offline. 2019-04-24T13:58:16.826353+08:00 PDB2(5):File copy for ts-TEMP skipped for excluded/offline tablespace
DGMGRL> swithover to ora12c_dg Unrecognized command "swithover", try "help" DGMGRL> switchover to ora12c_dg Performing switchover NOW, please wait... Operation requires a connection to database "ora12c_dg" Connecting ... Connected to "ORA12C_DG" Connected as SYSDBA. New primary database "ora12c_dg" is opening... Operation requires start up of instance "ora12c" on database "ora12c" Starting instance "ora12c"... ORACLE instance started. Database mounted. Database opened. Connected to "ora12c" Switchover succeeded, new primary is "ora12c_dg"
sys@ORA12C> col namefor a120 sys@ORA12C> selectname, status from v$datafile;
NAME STATUS ------------------------------------------------------------------------------------------------------------------------ ------- /u01/app/oracle/oradata/ORA12C_DG/874511D1C1D14E3BE0536892A8C07D48/datafile/o1_mf_system_gd0g96yn_.dbf SYSTEM /u01/app/oracle/oradata/ORA12C_DG/874511D1C1D14E3BE0536892A8C07D48/datafile/o1_mf_sysaux_gd0gb7nr_.dbf RECOVER /u01/app/oracle/oradata/ORA12C_DG/874511D1C1D14E3BE0536892A8C07D48/datafile/o1_mf_undotbs1_gd0gcnsc_.dbf RECOVER
sys@ORA12C> select * from v$recover_file;
norows selected
sys@ORA12C> selectname, recovery_status from v$pdbs wherename = 'PDB2';
NAME RECOVERY ------------------------------------------------------------------------------------------------------------------------ -------- PDB2 ENABLED