PDB$seed 如何避免不备份 没有必须重建DB unplug pdb 19C可以打开DB

Oracle Database - Enterprise Edition - Version 19.12.0.0.0 and later
Information in this document applies to any platform.

SYMPTOMS

RMAN Level 0 Backup skipping PDB$SEED datafile .

Requirement is to backup all files and not skip any datafiles each time Level 0 is run.

We can see this Message in the RMAN log its already backed up 1 time

 

skipping datafile 2; already backed up 1 time(s)
skipping datafile 4; already backed up 1 time(s)
skipping datafile 6; already backed up 1 time(s)

CHANGES

CAUSE

 If RMAN determines that a file is identical and it has been backed up, then it is a candidate to be skipped

Sine PDB$SEED are Read only   RMAN uses Optimziation as the Checkpoint SCN doesnot Change Rman will Skip if they have been backed up once's.

Hence If PDB$SEED datafiles are already backed up, the PDB$SEED datafiles are not backed up again.

SOLUTION

In your Backup script include force option

So your level 0 backup script you can change


RMAN> BACKUP INCREMENTAL LEVEL 0 AS COMPRESSED BACKUPSET FILESPERSET 10 DATABASE


to


RMAN> BACKUP INCREMENTAL LEVEL 0 AS COMPRESSED BACKUPSET FILESPERSET 10 DATABASE force ;               (included force option)


This will Ensure PDB$SEED is backed up every time Level 0 is backed up

OR
 

RMAN> CONFIGURE BACKUP OPTIMIZATION off ;



Retry your Original script

-----------------------如果没有只能重建

GOAL

 PDB$SEED datafile is missing from the filesystem and there is no backup available.  This articles describes how to over come this issue when there are No valid backup of PDB$SEED.

SOLUTION

Since PDB$SEED can not be used as a pluggable database, there is no way to fix the issue in the original database so the DBA needs to create another CDB, unplug all the pluggable database (except PDB$SEED), and plug all those pluggable database(s) into the newly created CDB.   

Please refer to Chapter 38 Creating and Removing PDBs with SQL*Plus of the Oracle 12c Database Administrator's Guide:
Creating and Removing PDBs with SQL*Plus

Create a new CDB along with PDB$SEED.  For example:

CREATE DATABASE newcdb
USER SYS IDENTIFIED BY sys_password
USER SYSTEM IDENTIFIED BY system_password
LOGFILE GROUP 1 ('/u01/logs/my/redo01a.log','/u02/logs/my/redo01b.log')
SIZE 100M BLOCKSIZE 512,
GROUP 2 ('/u01/logs/my/redo02a.log','/u02/logs/my/redo02b.log')
SIZE 100M BLOCKSIZE 512,
GROUP 3 ('/u01/logs/my/redo03a.log','/u02/logs/my/redo03b.log')
SIZE 100M BLOCKSIZE 512
MAXLOGHISTORY 1
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 1024
CHARACTER SET AL32UTF8
NATIONAL CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
DATAFILE '/u01/app/oracle/oradata/newcdb/system01.dbf'
SIZE 700M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
SYSAUX DATAFILE '/u01/app/oracle/oradata/newcdb/sysaux01.dbf'
SIZE 550M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
DEFAULT TABLESPACE deftbs
DATAFILE '/u01/app/oracle/oradata/newcdb/deftbs01.dbf'
SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE tempts1
TEMPFILE '/u01/app/oracle/oradata/newcdb/temp01.dbf'
SIZE 20M REUSE AUTOEXTEND ON NEXT 640K MAXSIZE UNLIMITED
UNDO TABLESPACE undotbs1
DATAFILE '/u01/app/oracle/oradata/newcdb/undotbs01.dbf'
SIZE 200M REUSE AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED
ENABLE PLUGGABLE DATABASE
SEED
FILE_NAME_CONVERT = ('/u01/app/oracle/oradata/newcdb/',
'/u01/app/oracle/oradata/pdbseed/')
SYSTEM DATAFILES SIZE 125M AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITED
SYSAUX DATAFILES SIZE 100M
USER_DATA TABLESPACE usertbs
DATAFILE '/u01/app/oracle/oradata/pdbseed/usertbs01.dbf'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;

Unplug the PDB database.  For example:

SQL> select CON_ID,NAME,OPEN_MODE from V$CONTAINERS;

CON_ID NAME OPEN_MODE
---------- ------------------------------ ----------
1 CDB$ROOT READ WRITE
2 PDB$SEED READ ONLY
3 PDB1 MOUNTED

SQL> alter session set container= CDB$ROOT;

Session altered.

SQL> alter pluggable database pdb1 unplug into '/tmp/PDB1/pdb1.xml';

Pluggable database altered.

SQL> drop pluggable database pdb1 keep datafiles;

Pluggable database dropped.

 Login into the new CDB database and plugin the PDB into the new CDB.  For example:

SQL> select CON_ID,NAME,OPEN_MODE from V$CONTAINERS;

CON_ID NAME OPEN_MODE
---------- ------------------------------ ----------
1 CDB$ROOT READ WRITE
2 PDB$SEED READ ONLY

SQL> alter session set container= CDB$ROOT;

Session altered.

SQL> create pluggable database pdb_plug_nocopy using '/tmp/PDB1/pdb1.xml'
NOCOPY
TEMPFILE REUSE; 2 3

Pluggable database created.

Check if Pluggable database is visible.  For example:

SQL> select CON_ID,NAME,OPEN_MODE from V$CONTAINERS;

CON_ID NAME OPEN_MODE
---------- ------------------------------ ----------
1 CDB$ROOT READ WRITE
2 PDB$SEED READ ONLY
3 PDB_PLUG_NOCOPY MOUNTED

Open the plugged in database and verify.  For example: 

SQL> alter pluggable database PDB_PLUG_NOCOPY open;

Pluggable database altered.

SQL> alter session set container=PDB_PLUG_NOCOPY;

Session altered.

SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
3 PDB_PLUG_NOCOPY READ WRITE NO
SQL>

SQL> select name from v$datafile;

NAME
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/u01/app/oracle/oradata/CDB12CR1/datafile/o1_mf_undotbs1_bnp2rqtg_.dbf
/u01/app/oracle/oradata/CDB12CR1/15796DF9D1F564F9E0533220B80A66FF/datafile/o1_mf_system_bnp37hxx_.dbf
/u01/app/oracle/oradata/CDB12CR1/15796DF9D1F564F9E0533220B80A66FF/datafile/o1_mf_sysaux_bnp37hg3_.dbf
/u01/app/oracle/oradata/CDB12CR1/15796DF9D1F564F9E0533220B80A66FF/datafile/o1_mf_users_bnp39br0_.dbf

SQL>

--------------------

 RMAN retains archivelog backups in Oracle Object Storage beyond your retention window.

CHANGES

 PDB$SEED(the seed PDB) is usually opened with READ ONLY mode. SCN of PDB$SEED datafiles move forwards if either Datapatch of Oracle Database patch or Oracle REST Data Services(ORDS) reconfiguration is performed because this task requires opening PDB$SEED with READ WRITE mode temporarily.---正常不会打开的

CAUSE

RMAN decides what archivelog files need to be retained based on datafiles' SCNs (System Change Number). If you look at either "list datafilecopy all" or "list backup of database", you will find datafiles of PDB$SEED has SCN older than other datafiles. If bkup_oss_recovery_window = 30 is configured for DBCS backup, you may find 60 days, 59 days, 58 days ... 32 days, 31 days old archivelog backups in Oracle Object Storage. RMAN retains consecutive archivelog backups regardless of retention window so that Oracle Database can go back to the oldest day within recovery window.  This is an expected behavior. 

SOLUTION

 To minimize amount of archivelog backups beyond retention window please perform these tasks along to your backup & recovery strategy.

1. Create a sql script : reopen_seed.sql, save it to /home/oracle

alter session set container = PDB$SEED;
alter session set "_oracle_script"=TRUE;
alter pluggable database PDB$SEED close immediate;
alter pluggable database PDB$SEED open read write;
alter pluggable database PDB$SEED close;
alter pluggable database PDB$SEED open read only;
exit; 

NOTE: alter session set "_oracle_script"=TRUE; is only required for Oracle Database 12.1.


2. Create a shell script : REOPEN_SEED.sh, save it to /home/oracle then chmod +x REOPEN_SEED.sh

#/bin/bash
source .bashrc
sqlplus / as sysdba @reopen_seed.sql
exit

3. Check your daily backup in /etc/crontab.  The following example causes your daily backup is performed at 00:08 am every day:


[oracle@hostname ~]$ cat /etc/crontab |grep bkup_start
8 0 * * * root /var/opt/oracle/bkup_api/bkup_api bkup_start --dbname=ORCL
[oracle@hostname ~]$
 

4. Configure REOPEN_SEED.sh in "Oracle" user's crontab to be executed every day 10 minutes earlier than your daily backup:

[oracle@hostname ~]$ crontab -e
SHELL=/bin/bash
ORACLE_SID=<SID>
ORACLE_BASE=<path> 
ORACLE_HOME=/<path>
PATH=$HOME:/sbin:/bin:/usr/sbin:/usr/bin:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch
#
58 23 * * * /home/oracle/REOPEN_SEED.sh

[oracle@hostname ~]$ 

NOTE: Logically executing this script once a week prior to full/level0 backup should be enough but executing it daily basis is suggested as you may change your backup cycle in the future. 

After this solution is implemented, every week full/level0 backup will contain PDB$SEED backup which its SCN has moved forward. Archivelog backups beyond retention window will be deleted in a timely manner. In addition, RMAN no longer retains archivelog backups beyond retention window for PDB$SEED recovery.

NOTE:  This same concept can be applied if you have any PDB in READ ONLY mode.

-------------------PDB$seed 损坏处理-----------------------------------------------------

We have the above pending patch errors for PDB$seed. How to resolve it.

 ++ Following is the Execution - Example

[oracle@exadb03 ~]$ . oraenv
ORACLE_SID = [cicnad3] ? dbins3
The Oracle base has been set to /u01/app/oracle
[oracle@exadb03 ~]$ cd $ORACLE_HOME/rdbms/admin

[oracle@exadb03 admin]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Thu Sep 1 10:03:53 2016

Copyright (c) 1982, 2014, Oracle. All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options

SQL> show parameter name

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cell_offloadgroup_name string
db_file_name_convert string
db_name string dbins
db_unique_name string dbins
global_names boolean FALSE
instance_name string dbins3
lock_name_space string
log_file_name_convert string
pdb_file_name_convert string
processor_group_name string
service_names string dbins.thehartford.com

SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 XXXXX READ WRITE NO

SQL> col name for a15
SQL> col cause for a15
col message for a60
set linesize 120
set pagesize 3300
col action for a20
col message for a40

select name, cause, type, message, status, action from PDB_PLUG_IN_VIOLATIONS where type like 'ERROR%' and status like 'PENDING' ;

NAME                CAUSE                  TYPE          MESSAGE                                       STATUS      ACTION
---------------     ---------------       ---------     ----------------------------------------       ---------  --------------------
PDB$SEED            SQL Patch              ERROR         DBBP bundle patch 160719 (DATABASE BUNDL      PENDING    Call datapatch to in
                                                         E PATCH: 12.1.0.2.160719 (23144544)): In                 stall in the PDB or
                                                         stalled in the PDB but not in the CDB.                   the CDB

PDB$SEED            SQL Patch              ERROR         SQL patch ID/UID 16623661/19865160 (NO E      PENDING    Call datapatch to in
                                                         MAIL NOTIFICATION IS SENT BY ORACLE SCHE                 stall in the PDB or
                                                         DULER): Installed in the PDB but not in                  the CDB
                                                         the CDB.

PDB$SEED            SQL Patch              ERROR         SQL patch ID/UID 18672264/19863082 (ORA-      PENDING    Call datapatch to in
                                                         39083, ORA-31000 FROM IMPDP FOR XMLSCHEM                 stall in the PDB or
                                                         A): Installed in the PDB but not in the                  the CDB
                                                         CDB.

SQL> alter session set container=PDB$SEED;

Session altered.

SQL> show con_name

CON_NAME
------------------------------
PDB$SEED

SQL> select open_mode from v$database;

OPEN_MODE
--------------------
READ ONLY

SQL> alter session set "_oracle_script"=TRUE;

Session altered.

SQL> alter pluggable database pdb$seed close immediate instances=all;

Pluggable database altered.

SQL> select open_mode from v$database;

OPEN_MODE
--------------------
MOUNTED

SQL> alter pluggable database pdb$seed OPEN READ WRITE;

Pluggable database altered.

SQL> show con_name;

CON_NAME
------------------------------
PDB$SEED

SQL> select open_mode from v$database;

OPEN_MODE
--------------------
READ WRITE

SQL> @utlrp

TIMESTAMP
------------------------------------------------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_BGN 2016-09-01 10:06:39

PL/SQL procedure successfully completed.

Function dropped.

...Database user "SYS", database schema "APEX_040200", user# "98" 10:07:20
...Compiled 0 out of 3014 objects considered, 0 failed compilation 10:07:21
...271 packages
...263 package bodies
...452 tables
...11 functions
...16 procedures
...3 sequences
...457 triggers
...1320 indexes
...211 views
...0 libraries
...6 types
...0 type bodies
...0 operators
...0 index types
...Begin key object existence check 10:07:21
...Completed key object existence check 10:07:21
...Setting DBMS Registry 10:07:21
...Setting DBMS Registry Complete 10:07:21
...Exiting validate 10:07:21

PL/SQL procedure successfully completed.

SQL> col COMP_NAME for a35;
col COMP_ID for a10;
set linesize 120;

SQL> select comp_id, comp_name, version, status from dba_registry;

COMP_ID COMP_NAME VERSION STATUS
---------- ----------------------------------- ------------------------------ -----------
DV Oracle Database Vault 12.1.0.2.0 VALID
APEX Oracle Application Express 4.2.5.00.08 VALID
OLS Oracle Label Security 12.1.0.2.0 VALID
SDO Spatial 12.1.0.2.0 VALID
ORDIM Oracle Multimedia 12.1.0.2.0 VALID
CONTEXT Oracle Text 12.1.0.2.0 VALID
OWM Oracle Workspace Manager 12.1.0.2.0 VALID
XDB Oracle XML Database 12.1.0.2.0 VALID
CATALOG Oracle Database Catalog Views 12.1.0.2.0 VALID
CATPROC Oracle Database Packages and Types 12.1.0.2.0 VALID
JAVAVM JServer JAVA Virtual Machine 12.1.0.2.0 VALID
XML Oracle XDK 12.1.0.2.0 VALID
CATJAVA Oracle Database Java Packages 12.1.0.2.0 VALID
APS OLAP Analytic Workspace 12.1.0.2.0 VALID
XOQ Oracle OLAP API 12.1.0.2.0 VALID
RAC Oracle Real Application Clusters 12.1.0.2.0 VALID

16 rows selected.

SQL> select count(*) from dba_objects where status='INVALID';

COUNT(*)
----------
0

SQL> col OBJECT_NAME for a30;
select object_name, object_type, owner from dba_objects where status='INVALID' order by owner;

no rows selected

SQL> SELECT OWNER, OBJECT_TYPE, COUNT(*) FROM DBA_OBJECTS WHERE STATUS = 'INVALID' GROUP BY OWNER, OBJECT_TYPE;

no rows selected

SQL> alter pluggable database pdb$seed close immediate instances=all;

Pluggable database altered.

SQL> alter pluggable database pdb$seed OPEN READ ONLY;

Pluggable database altered.

SQL> show con_name;

CON_NAME
------------------------------
PDB$SEED

SQL> select open_mode from v$database;

OPEN_MODE
--------------------
READ ONLY

SQL> alter session set "_oracle_script"=FALSE;

Session altered.

SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO

SQL> alter session set container = cdb$root;

Session altered.

SQL> col name for a15
col cause for a15
col message for a60
set linesize 120
set pagesize 3300
col action for a20
col message for a40
select name, cause, type, message, status, action from PDB_PLUG_IN_VIOLATIONS where type like 'ERROR%' and status like 'PENDING' ;

no rows selected

-----------------------------------19C pdbseed不备份也可以打开


 

RMAN> startup force mount;

Oracle instance started
database mounted

Total System Global Area    2382361320 bytes

Fixed Size                     9167592 bytes
Variable Size                956301312 bytes
Database Buffers            1409286144 bytes
Redo Buffers                   7606272 bytes

RMAN> run 
2> {  
3> ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE' PARMS="SBT_LIBRARY=oracle.disksbt,ENV=(BACKUP_DIR=/nfs)";
4> restore pluggable database pdb ; #'cdb$root';
5> RELEASE CHANNEL ch00;
6> }

allocated channel: ch00
channel ch00: SID=789 instance=cdb3 device type=SBT_TAPE
channel ch00: WARNING: Oracle Test Disk API

Starting restore at 07-SEP-24

channel ch00: starting datafile backup set restore
channel ch00: specifying datafile(s) to restore from backup set
channel ch00: restoring datafile 00014 to +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_3.363.1179025961
channel ch00: reading from backup piece fb34d0bu_491_1_1
channel ch00: piece handle=fb34d0bu_491_1_1 tag=TAG20240907T030949
channel ch00: restored backup piece 1
channel ch00: restore complete, elapsed time: 00:00:01
channel ch00: starting datafile backup set restore
channel ch00: specifying datafile(s) to restore from backup set
channel ch00: restoring datafile 00015 to +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_4.268.1179025963
channel ch00: reading from backup piece fc34d0bv_492_1_1
channel ch00: piece handle=fc34d0bv_492_1_1 tag=TAG20240907T030949
channel ch00: restored backup piece 1
channel ch00: restore complete, elapsed time: 00:00:03
channel ch00: starting datafile backup set restore
channel ch00: specifying datafile(s) to restore from backup set
channel ch00: restoring datafile 00016 to +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/users.265.1179025963
channel ch00: reading from backup piece fg34d0c0_496_1_1
channel ch00: piece handle=fg34d0c0_496_1_1 tag=TAG20240907T030949
channel ch00: restored backup piece 1
channel ch00: restore complete, elapsed time: 00:00:01
channel ch00: starting datafile backup set restore
channel ch00: specifying datafile(s) to restore from backup set
channel ch00: restoring datafile 00013 to +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undotbs1.270.1179025965
channel ch00: reading from backup piece fa34d0bu_490_1_1
channel ch00: piece handle=fa34d0bu_490_1_1 tag=TAG20240907T030949
channel ch00: restored backup piece 1
channel ch00: restore complete, elapsed time: 00:00:07
channel ch00: starting datafile backup set restore
channel ch00: specifying datafile(s) to restore from backup set
channel ch00: restoring datafile 00012 to +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/sysaux.267.1179025971
channel ch00: reading from backup piece f834d0bu_488_1_1
channel ch00: piece handle=f834d0bu_488_1_1 tag=TAG20240907T030949
channel ch00: restored backup piece 1
channel ch00: restore complete, elapsed time: 00:00:07
channel ch00: starting datafile backup set restore
channel ch00: specifying datafile(s) to restore from backup set
channel ch00: restoring datafile 00011 to +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/system.269.1179025979
channel ch00: reading from backup piece f734d0bu_487_1_1
channel ch00: piece handle=f734d0bu_487_1_1 tag=TAG20240907T030949
channel ch00: restored backup piece 1
channel ch00: restore complete, elapsed time: 00:00:15
Finished restore at 07-SEP-24

released channel: ch00

RMAN> alter database open;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of sql statement command at 09/07/2024 03:23:44
ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
ORA-01110: data file 1: '+DATA/CDB/DATAFILE/system.287.1179026113'

RMAN> run 
2> {  
3> ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE' PARMS="SBT_LIBRARY=oracle.disksbt,ENV=(BACKUP_DIR=/nfs)";
4> restore pluggable database 'cdb$root';
5> RELEASE CHANNEL ch00;
6> }

allocated channel: ch00
channel ch00: SID=789 instance=cdb3 device type=SBT_TAPE
channel ch00: WARNING: Oracle Test Disk API

Starting restore at 07-SEP-24

channel ch00: starting datafile backup set restore
channel ch00: specifying datafile(s) to restore from backup set
channel ch00: restoring datafile 00020 to +DATA/CDB/DATAFILE/test.347.1179026089
channel ch00: reading from backup piece fd34d0bv_493_1_1
channel ch00: piece handle=fd34d0bv_493_1_1 tag=TAG20240907T030949
channel ch00: restored backup piece 1
channel ch00: restore complete, elapsed time: 00:00:01
channel ch00: starting datafile backup set restore
channel ch00: specifying datafile(s) to restore from backup set
channel ch00: restoring datafile 00004 to +DATA/CDB/DATAFILE/undotbs1.282.1179026089
channel ch00: reading from backup piece f634d0bu_486_1_1
channel ch00: piece handle=f634d0bu_486_1_1 tag=TAG20240907T030949
channel ch00: restored backup piece 1
channel ch00: restore complete, elapsed time: 00:00:03
channel ch00: starting datafile backup set restore
channel ch00: specifying datafile(s) to restore from backup set
channel ch00: restoring datafile 00007 to +DATA/CDB/DATAFILE/users.275.1179026093
channel ch00: reading from backup piece ff34d0bv_495_1_1
channel ch00: piece handle=ff34d0bv_495_1_1 tag=TAG20240907T030949
channel ch00: restored backup piece 1
channel ch00: restore complete, elapsed time: 00:00:01
channel ch00: starting datafile backup set restore
channel ch00: specifying datafile(s) to restore from backup set
channel ch00: restoring datafile 00010 to +DATA/CDB/DATAFILE/undotbs3.360.1179026093
channel ch00: reading from backup piece fe34d0bv_494_1_1
channel ch00: piece handle=fe34d0bv_494_1_1 tag=TAG20240907T030949
channel ch00: restored backup piece 1
channel ch00: restore complete, elapsed time: 00:00:01
channel ch00: starting datafile backup set restore
channel ch00: specifying datafile(s) to restore from backup set
channel ch00: restoring datafile 00009 to +DATA/CDB/DATAFILE/undotbs2.274.1179026095
channel ch00: reading from backup piece f934d0bu_489_1_1
channel ch00: piece handle=f934d0bu_489_1_1 tag=TAG20240907T030949
channel ch00: restored backup piece 1
channel ch00: restore complete, elapsed time: 00:00:03
channel ch00: starting datafile backup set restore
channel ch00: specifying datafile(s) to restore from backup set
channel ch00: restoring datafile 00003 to +DATA/CDB/DATAFILE/sysaux.261.1179026097
channel ch00: reading from backup piece f534d0bu_485_1_1
channel ch00: piece handle=f534d0bu_485_1_1 tag=TAG20240907T030949
channel ch00: restored backup piece 1
channel ch00: restore complete, elapsed time: 00:00:15
channel ch00: starting datafile backup set restore
channel ch00: specifying datafile(s) to restore from backup set
channel ch00: restoring datafile 00001 to +DATA/CDB/DATAFILE/system.287.1179026113
channel ch00: reading from backup piece f434d0bu_484_1_1
channel ch00: piece handle=f434d0bu_484_1_1 tag=TAG20240907T030949
channel ch00: restored backup piece 1
channel ch00: restore complete, elapsed time: 00:00:35
Finished restore at 07-SEP-24

released channel: ch00

RMAN> alter database open;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of sql statement command at 09/07/2024 03:25:06
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '+DATA/CDB/DATAFILE/system.363.1179026669'

RMAN> recover database;

Starting recover at 07-SEP-24
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=789 instance=cdb3 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=792 instance=cdb3 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=797 instance=cdb3 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=40 instance=cdb3 device type=DISK
allocated channel: ORA_DISK_5
channel ORA_DISK_5: SID=796 instance=cdb3 device type=DISK
allocated channel: ORA_DISK_6
channel ORA_DISK_6: SID=41 instance=cdb3 device type=DISK
allocated channel: ORA_DISK_7
channel ORA_DISK_7: SID=798 instance=cdb3 device type=DISK
allocated channel: ORA_DISK_8
channel ORA_DISK_8: SID=42 instance=cdb3 device type=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 09/07/2024 03:25:12
RMAN-07551: data file 5 must be restored or preplugin recovery must be completed

RMAN> report schema;

Report of database schema for database with db_unique_name CDB

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    1180     SYSTEM               ***     +DATA/CDB/DATAFILE/system.363.1179026669
3    1000     SYSAUX               ***     +DATA/CDB/DATAFILE/sysaux.268.1179026653
4    615      UNDOTBS1             ***     +DATA/CDB/DATAFILE/undotbs1.269.1179026645
5    0        PDB$SEED:SYSTEM      ***     +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/system.293.1179026347
6    0        PDB$SEED:SYSAUX      ***     +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/sysaux.258.1179026347
7    28       USERS                ***     +DATA/CDB/DATAFILE/users.267.1179026649
8    0        PDB$SEED:UNDOTBS1    ***     +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/undotbs1.284.1179026347
9    250      UNDOTBS2             ***     +DATA/CDB/DATAFILE/undotbs2.265.1179026651
10   75       UNDOTBS3             ***     +DATA/CDB/DATAFILE/undotbs3.270.1179026649
11   540      PDB:SYSTEM           ***     +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/system.282.1179026605
12   490      PDB:SYSAUX           ***     +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/sysaux.275.1179026597
13   215      PDB:UNDOTBS1         ***     +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undotbs1.360.1179026589
14   215      PDB:UNDO_3           ***     +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_3.287.1179026585
15   215      PDB:UNDO_4           ***     +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/undo_4.261.1179026585
16   5        PDB:USERS            ***     +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/DATAFILE/users.274.1179026589
20   100      TEST                 ***     +DATA/CDB/DATAFILE/test.347.1179026645

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    44       TEMP                 32767       +DATA/CDB/TEMPFILE/temp.263.1173663343
2    36       PDB$SEED:TEMP        32767       +DATA/CDB/0633F844101D69CBE0636401A8C09D55/TEMPFILE/temp.264.1179026395
3    100      PDB:TEMP             32767       +DATA/CDB/06344F62B8C65A17E0636401A8C0F073/TEMPFILE/temp.266.1179026163

RMAN> recover  pluggable database 'cdb$root',pdb;  不需要pdbseed也可以打开

Starting recover at 07-SEP-24
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
using channel ORA_DISK_5
using channel ORA_DISK_6
using channel ORA_DISK_7
using channel ORA_DISK_8

starting media recovery

archived log for thread 3 with sequence 43 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_09_07/thread_3_seq_43.399.1179026159
archived log for thread 3 with sequence 44 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_09_07/thread_3_seq_44.315.1179026393
archived log for thread 3 with sequence 45 is already on disk as file +DATA1/CDB/ARCHIVELOG/2024_09_07/thread_3_seq_45.336.1179026543
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_09_07/thread_3_seq_43.399.1179026159 thread=3 sequence=43
archived log file name=+DATA1/CDB/ARCHIVELOG/2024_09_07/thread_3_seq_44.315.1179026393 thread=3 sequence=44
media recovery complete, elapsed time: 00:00:02
Finished recover at 07-SEP-24

RMAN> alter database open;

Statement processed

RMAN> exit


Recovery Manager complete.
[oracle@rac3 rman_backup]$ s

SQL*Plus: Release 19.0.0.0.0 - Production on Sat Sep 7 03:26:10 2024
Version 19.20.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.20.0.0.0

SQL> show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       MOUNTED
         3 PDB                            READ WRITE YES
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.20.0.0.0
[oracle@rac3 rman_backup]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Sat Sep 7 03:26:17 2024
Version 19.20.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

connected to target database: CDB (DBID=2265125454)

RMAN> run 
2> {  
3> ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE' PARMS="SBT_LIBRARY=oracle.disksbt,ENV=(BACKUP_DIR=/nfs)";
4> restore pluggable database 'pdb$seed';
5> RELEASE CHANNEL ch00;
6> }

using target database control file instead of recovery catalog
allocated channel: ch00
channel ch00: SID=829 instance=cdb3 device type=SBT_TAPE
channel ch00: WARNING: Oracle Test Disk API

Starting restore at 07-SEP-24

released channel: ch00
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 09/07/2024 03:26:35
RMAN-06026: some targets not found - aborting restore
RMAN-06100: no channel to restore a backup or copy of datafile 8
RMAN-06100: no channel to restore a backup or copy of datafile 6
RMAN-06100: no channel to restore a backup or copy of datafile 5  tape 没有backup

RMAN> restore pluggable database 'pdb$seed';  --disk 有备份

Starting restore at 07-SEP-24
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=829 instance=cdb3 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=792 instance=cdb3 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=796 instance=cdb3 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=49 instance=cdb3 device type=DISK
allocated channel: ORA_DISK_5
channel ORA_DISK_5: SID=797 instance=cdb3 device type=DISK
allocated channel: ORA_DISK_6
channel ORA_DISK_6: SID=39 instance=cdb3 device type=DISK
allocated channel: ORA_DISK_7
channel ORA_DISK_7: SID=789 instance=cdb3 device type=DISK
allocated channel: ORA_DISK_8
channel ORA_DISK_8: SID=73 instance=cdb3 device type=DISK

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00008 to +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/undotbs1.284.1179026347
channel ORA_DISK_1: reading from backup piece +DATA1/CDB/0633F844101D69CBE0636401A8C09D55/BACKUPSET/2024_09_07/nnndn0_cdb_20240907132547_level0_0.414.1179019553
channel ORA_DISK_2: starting datafile backup set restore
channel ORA_DISK_2: specifying datafile(s) to restore from backup set
channel ORA_DISK_2: restoring datafile 00006 to +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/sysaux.258.1179026347
channel ORA_DISK_2: reading from backup piece +DATA1/CDB/0633F844101D69CBE0636401A8C09D55/BACKUPSET/2024_09_07/nnndn0_cdb_20240907132547_level0_0.351.1179019553
channel ORA_DISK_3: starting datafile backup set restore
channel ORA_DISK_3: specifying datafile(s) to restore from backup set
channel ORA_DISK_3: restoring datafile 00005 to +DATA/CDB/0633F844101D69CBE0636401A8C09D55/DATAFILE/system.293.1179026347
channel ORA_DISK_3: reading from backup piece +DATA1/CDB/0633F844101D69CBE0636401A8C09D55/BACKUPSET/2024_09_07/nnndn0_cdb_20240907132547_level0_0.415.1179019553
channel ORA_DISK_1: piece handle=+DATA1/CDB/0633F844101D69CBE0636401A8C09D55/BACKUPSET/2024_09_07/nnndn0_cdb_20240907132547_level0_0.414.1179019553 tag=CDB_20240907132547_LEVEL0
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_DISK_2: piece handle=+DATA1/CDB/0633F844101D69CBE0636401A8C09D55/BACKUPSET/2024_09_07/nnndn0_cdb_20240907132547_level0_0.351.1179019553 tag=CDB_20240907132547_LEVEL0
channel ORA_DISK_2: restored backup piece 1
channel ORA_DISK_2: restore complete, elapsed time: 00:00:15
channel ORA_DISK_3: piece handle=+DATA1/CDB/0633F844101D69CBE0636401A8C09D55/BACKUPSET/2024_09_07/nnndn0_cdb_20240907132547_level0_0.415.1179019553 tag=CDB_20240907132547_LEVEL0
channel ORA_DISK_3: restored backup piece 1
channel ORA_DISK_3: restore complete, elapsed time: 00:00:25
Finished restore at 07-SEP-24

RMAN> exit


Recovery Manager complete.
[oracle@rac3 rman_backup]$ s

SQL*Plus: Release 19.0.0.0.0 - Production on Sat Sep 7 03:27:08 2024
Version 19.20.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.20.0.0.0

SQL> show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       MOUNTED
         3 PDB                            READ WRITE YES
SQL> startup force ;----重启就可以了
ORACLE instance started.

Total System Global Area 2382361320 bytes
Fixed Size                  9167592 bytes
Variable Size             956301312 bytes
Database Buffers         1409286144 bytes
Redo Buffers                7606272 bytes
Database mounted.
Database opened.
SQL> show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB                            READ WRITE YES
SQL>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值