Sunday, May 25, 2025

How to take backup of oracle database plus archivelog ?

 

RMAN>


RMAN> backup database plus archivelog ;



Starting backup at 25-MAY-25

current log archived

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=278 device type=DISK

channel ORA_DISK_1: starting archived log backup set

channel ORA_DISK_1: specifying archived log(s) in backup set

input archived log thread=1 sequence=22 RECID=17 STAMP=1201966510

input archived log thread=1 sequence=23 RECID=18 STAMP=1201968926

input archived log thread=1 sequence=24 RECID=19 STAMP=1201970163

input archived log thread=1 sequence=25 RECID=20 STAMP=1202022953

input archived log thread=1 sequence=26 RECID=21 STAMP=1202026475

channel ORA_DISK_1: starting piece 1 at 25-MAY-25

channel ORA_DISK_1: finished piece 1 at 25-MAY-25

piece handle=/u01/app/oracle/fast_recovery_area/DB1/backupset/2025_05_25/o1_mf_annnn_TAG20250525T081436_n35ncf0p_.bkp tag=TAG20250525T081436 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:04

Finished backup at 25-MAY-25


Starting backup at 25-MAY-25

using channel ORA_DISK_1

channel ORA_DISK_1: starting full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

input datafile file number=00001 name=/u01/app/oracle/oradata/DB1/system01.dbf

input datafile file number=00003 name=/u01/app/oracle/oradata/DB1/sysaux01.dbf

input datafile file number=00004 name=/u01/app/oracle/oradata/DB1/undotbs01.dbf

input datafile file number=00007 name=/u01/app/oracle/oradata/DB1/users01.dbf

channel ORA_DISK_1: starting piece 1 at 25-MAY-25

channel ORA_DISK_1: finished piece 1 at 25-MAY-25

piece handle=/u01/app/oracle/fast_recovery_area/DB1/backupset/2025_05_25/o1_mf_nnndf_TAG20250525T081440_n35ncno8_.bkp tag=TAG20250525T081440 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35

channel ORA_DISK_1: starting full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

input datafile file number=00010 name=/u01/app/oracle/oradata/DB1/pdb/sysaux01.dbf

input datafile file number=00009 name=/u01/app/oracle/oradata/DB1/pdb/system01.dbf

input datafile file number=00011 name=/u01/app/oracle/oradata/DB1/pdb/undotbs01.dbf

input datafile file number=00012 name=/u01/app/oracle/oradata/DB1/pdb/users01.dbf

channel ORA_DISK_1: starting piece 1 at 25-MAY-25

channel ORA_DISK_1: finished piece 1 at 25-MAY-25

piece handle=/u01/app/oracle/fast_recovery_area/DB1/2FACECCE69615207E0630400040AB366/backupset/2025_05_25/o1_mf_nnndf_TAG20250525T081440_n35ndnx1_.bkp tag=TAG20250525T081440 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15

channel ORA_DISK_1: starting full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

input datafile file number=00017 name=/u01/app/oracle/oradata/demo1/sysaux01.dbf

input datafile file number=00016 name=/u01/app/oracle/oradata/demo1/system01.dbf

input datafile file number=00018 name=/u01/app/oracle/oradata/demo1/undotbs01.dbf

channel ORA_DISK_1: starting piece 1 at 25-MAY-25

channel ORA_DISK_1: finished piece 1 at 25-MAY-25

piece handle=/u01/app/oracle/fast_recovery_area/DB1/33E6395D57264163E0630400040A2C41/backupset/2025_05_25/o1_mf_nnndf_TAG20250525T081440_n35nf4bh_.bkp tag=TAG20250525T081440 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15

channel ORA_DISK_1: starting full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

input datafile file number=00006 name=/u01/app/oracle/oradata/DB1/pdbseed/sysaux01.dbf

input datafile file number=00005 name=/u01/app/oracle/oradata/DB1/pdbseed/system01.dbf

input datafile file number=00008 name=/u01/app/oracle/oradata/DB1/pdbseed/undotbs01.dbf

channel ORA_DISK_1: starting piece 1 at 25-MAY-25

channel ORA_DISK_1: finished piece 1 at 25-MAY-25

piece handle=/u01/app/oracle/fast_recovery_area/DB1/2FAC79D13BBE3BB3E0630400040A98FA/backupset/2025_05_25/o1_mf_nnndf_TAG20250525T081440_n35nfmyv_.bkp tag=TAG20250525T081440 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15

Finished backup at 25-MAY-25


Starting backup at 25-MAY-25

current log archived

using channel ORA_DISK_1

channel ORA_DISK_1: starting archived log backup set

channel ORA_DISK_1: specifying archived log(s) in backup set

input archived log thread=1 sequence=27 RECID=22 STAMP=1202026564

channel ORA_DISK_1: starting piece 1 at 25-MAY-25

channel ORA_DISK_1: finished piece 1 at 25-MAY-25

piece handle=/u01/app/oracle/fast_recovery_area/DB1/backupset/2025_05_25/o1_mf_annnn_TAG20250525T081604_n35ng5fm_.bkp tag=TAG20250525T081604 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

Finished backup at 25-MAY-25


Starting Control File and SPFILE Autobackup at 25-MAY-25

piece handle=/u01/app/oracle/fast_recovery_area/DB1/autobackup/2025_05_25/o1_mf_s_1202026566_n35ng924_.bkp comment=NONE

Finished Control File and SPFILE Autobackup at 25-MAY-25


RMAN>

How to recover oracle database from loss of critical data files (system.dbf) ?

Recover database from loss of critical data files 



*Should we have good backup 


SQL> show pdbs


    CON_ID CON_NAME                       OPEN MODE  RESTRICTED

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

         2 PDB$SEED                       READ ONLY  NO

         3 PDB                            MOUNTED

         4 DEMO1                          MOUNTED

SQL> alter pluggable database all open ;

alter pluggable database all open

*

ERROR at line 1:

ORA-01116: error in opening database file 1

ORA-01110: data file 1: '/u01/app/oracle/oradata/DB1/system01.dbf'

ORA-27041: unable to open file

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3



SQL>



SQL> shut abort ;

ORACLE instance shut down.

SQL> exit

Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.3.0.0.0

[oracle@orcl DB1]$

[oracle@orcl DB1]$ rman target /


Recovery Manager: Release 19.0.0.0.0 - Production on Sun May 25 08:56:06 2025

Version 19.3.0.0.0


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


connected to target database (not started)


RMAN> startup mount ;


Oracle instance started

database mounted


Total System Global Area    2432695832 bytes


Fixed Size                     9137688 bytes

Variable Size                553648128 bytes

Database Buffers            1862270976 bytes

Redo Buffers                   7639040 bytes


RMAN> restore datafile 1;


Starting restore at 25-MAY-25

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=257 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 00001 to /u01/app/oracle/oradata/DB1/system01.dbf

channel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/DB1/backupset/2025_05_25/o1_mf_nnndf_TAG20250525T081440_n35ncno8_.bkp

channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/DB1/backupset/2025_05_25/o1_mf_nnndf_TAG20250525T081440_n35ncno8_.bkp tag=TAG20250525T081440

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:00:25

Finished restore at 25-MAY-25


RMAN> recover datafile 1;


Starting recover at 25-MAY-25

using channel ORA_DISK_1


starting media recovery

media recovery complete, elapsed time: 00:00:03


Finished recover at 25-MAY-25


RMAN> alter database open ;


Statement processed


RMAN> alter pluggable database all open ;


Statement processed


RMAN> exit



Recovery Manager complete.

[oracle@orcl DB1]$ sqlplus "/as sysdba"


SQL*Plus: Release 19.0.0.0.0 - Production on Sun May 25 08:58:08 2025

Version 19.3.0.0.0


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



Connected to:

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.3.0.0.0


SQL> show pdbs


    CON_ID CON_NAME                       OPEN MODE  RESTRICTED

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

         2 PDB$SEED                       READ ONLY  NO

         3 PDB                            READ WRITE NO

         4 DEMO1                          READ WRITE NO

SQL>

Saturday, May 24, 2025

How to create Virtual Private catalog and enable the VPD (virtual private database ) feature in rman catalog with upgrade ?

[oracle@orcl ~]$

[oracle@orcl ~]$ sqlplus sys/sys@demopdb1 as sysdba


SQL*Plus: Release 19.0.0.0.0 - Production on Sat May 24 15:45:25 2025

Version 19.3.0.0.0


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



Connected to:

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.3.0.0.0


SQL> @$ORACLE_HOME/rdbms/admin/dbmsrmanvpc.sql vpd rcatowner


Checking the operating user... Passed


The VPC user schemas of the following catalogs: VPD, RCATOWNER are going to be upgraded to a new VPD model


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

Removing old VPC views in the base catalog of RCATOWNER...

========================================

UPGRADE STATUS:

The VPC user schemas of these catalogs: RCATOWNER

have been successfully upgraded to the new VPD model!


Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.3.0.0.0

[oracle@orcl ~]$

[oracle@orcl ~]$

[oracle@orcl ~]$ rman catalog  rcatowner/oracle_4U@demopdb1


Recovery Manager: Release 19.0.0.0.0 - Production on Sat May 24 15:46:39 2025

Version 19.3.0.0.0


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


connected to recovery catalog database


RMAN> upgrade catalog ;


recovery catalog owner is RCATOWNER

enter UPGRADE CATALOG command again to confirm catalog upgrade


RMAN> upgrade catalog ;


RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-20516: cannot upgrade the catalog when other RMAN sessions are connected to catalog


RMAN> upgrade catalog ;


recovery catalog owner is RCATOWNER

enter UPGRADE CATALOG command again to confirm catalog upgrade


RMAN> upgrade catalog ;


recovery catalog upgraded to version 19.03.00.00.00

DBMS_RCVMAN package upgraded to version 19.03.00.00

DBMS_RCVCAT package upgraded to version 19.03.00.00.


RMAN>

How to execute stored script in rman catalog database ?

 

[oracle@orcl ~]$ rman target / catalog  rcatowner/oracle_4U@demopdb1


Recovery Manager: Release 19.0.0.0.0 - Production on Sat May 24 15:24:12 2025

Version 19.3.0.0.0


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


connected to target database: DB1 (DBID=1788905834)

connected to recovery catalog database

RMAN>


RMAN>


RMAN> run {

2> execute script db_plus_arc_bkp;

3> }


executing script: db_plus_arc_bkp



Starting backup at 24-MAY-25

current log archived

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=37 device type=DISK

channel ORA_DISK_1: starting archived log backup set

channel ORA_DISK_1: specifying archived log(s) in backup set

input archived log thread=1 sequence=17 RECID=12 STAMP=1201940579

input archived log thread=1 sequence=18 RECID=13 STAMP=1201956550

input archived log thread=1 sequence=19 RECID=14 STAMP=1201956572

input archived log thread=1 sequence=20 RECID=15 STAMP=1201961707

input archived log thread=1 sequence=21 RECID=16 STAMP=1201966425

channel ORA_DISK_1: starting piece 1 at 24-MAY-25

channel ORA_DISK_1: finished piece 1 at 24-MAY-25

piece handle=/u01/app/oracle/fast_recovery_area/DB1/backupset/2025_05_24/o1_mf_annnn_TAG20250524T153347_n33spwhd_.bkp tag=TAG20250524T153347 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07

Finished backup at 24-MAY-25


Starting backup at 24-MAY-25

using channel ORA_DISK_1

channel ORA_DISK_1: starting full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

input datafile file number=00001 name=/u01/app/oracle/oradata/DB1/system01.dbf

input datafile file number=00003 name=/u01/app/oracle/oradata/DB1/sysaux01.dbf

input datafile file number=00004 name=/u01/app/oracle/oradata/DB1/undotbs01.dbf

input datafile file number=00007 name=/u01/app/oracle/oradata/DB1/users01.dbf

channel ORA_DISK_1: starting piece 1 at 24-MAY-25

channel ORA_DISK_1: finished piece 1 at 24-MAY-25

piece handle=/u01/app/oracle/fast_recovery_area/DB1/backupset/2025_05_24/o1_mf_nnndf_TAG20250524T153355_n33sq62z_.bkp tag=TAG20250524T153355 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25

channel ORA_DISK_1: starting full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

input datafile file number=00010 name=/u01/app/oracle/oradata/DB1/pdb/sysaux01.dbf

input datafile file number=00009 name=/u01/app/oracle/oradata/DB1/pdb/system01.dbf

input datafile file number=00011 name=/u01/app/oracle/oradata/DB1/pdb/undotbs01.dbf

input datafile file number=00012 name=/u01/app/oracle/oradata/DB1/pdb/users01.dbf

channel ORA_DISK_1: starting piece 1 at 24-MAY-25

channel ORA_DISK_1: finished piece 1 at 24-MAY-25

piece handle=/u01/app/oracle/fast_recovery_area/DB1/2FACECCE69615207E0630400040AB366/backupset/2025_05_24/o1_mf_nnndf_TAG20250524T153355_n33sqyrs_.bkp tag=TAG20250524T153355 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15

channel ORA_DISK_1: starting full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

input datafile file number=00017 name=/u01/app/oracle/oradata/demo1/sysaux01.dbf

input datafile file number=00016 name=/u01/app/oracle/oradata/demo1/system01.dbf

input datafile file number=00018 name=/u01/app/oracle/oradata/demo1/undotbs01.dbf

channel ORA_DISK_1: starting piece 1 at 24-MAY-25

channel ORA_DISK_1: finished piece 1 at 24-MAY-25

piece handle=/u01/app/oracle/fast_recovery_area/DB1/33E6395D57264163E0630400040A2C41/backupset/2025_05_24/o1_mf_nnndf_TAG20250524T153355_n33srh8y_.bkp tag=TAG20250524T153355 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15

channel ORA_DISK_1: starting full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

input datafile file number=00006 name=/u01/app/oracle/oradata/DB1/pdbseed/sysaux01.dbf

input datafile file number=00005 name=/u01/app/oracle/oradata/DB1/pdbseed/system01.dbf

input datafile file number=00008 name=/u01/app/oracle/oradata/DB1/pdbseed/undotbs01.dbf

channel ORA_DISK_1: starting piece 1 at 24-MAY-25

channel ORA_DISK_1: finished piece 1 at 24-MAY-25

piece handle=/u01/app/oracle/fast_recovery_area/DB1/2FAC79D13BBE3BB3E0630400040A98FA/backupset/2025_05_24/o1_mf_nnndf_TAG20250524T153355_n33srxtp_.bkp tag=TAG20250524T153355 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15

Finished backup at 24-MAY-25


Starting backup at 24-MAY-25

current log archived

using channel ORA_DISK_1

channel ORA_DISK_1: starting archived log backup set

channel ORA_DISK_1: specifying archived log(s) in backup set

input archived log thread=1 sequence=22 RECID=17 STAMP=1201966510

channel ORA_DISK_1: starting piece 1 at 24-MAY-25

channel ORA_DISK_1: finished piece 1 at 24-MAY-25

piece handle=/u01/app/oracle/fast_recovery_area/DB1/backupset/2025_05_24/o1_mf_annnn_TAG20250524T153511_n33ssj1p_.bkp tag=TAG20250524T153511 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02

Finished backup at 24-MAY-25


Starting Control File and SPFILE Autobackup at 24-MAY-25

piece handle=/u01/app/oracle/fast_recovery_area/DB1/autobackup/2025_05_24/o1_mf_s_1201966514_n33ssnvx_.bkp comment=NONE

Finished Control File and SPFILE Autobackup at 24-MAY-25


RMAN retention policy will be applied to the command

RMAN retention policy is set to redundancy 1

using channel ORA_DISK_1

Deleting the following obsolete backups and copies:

Type                 Key    Completion Time    Filename/Handle

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

Archive Log          154    24-MAY-25          /u01/app/oracle/fast_recovery_area/DB1/archivelog/2025_05_24/o1_mf_1_17_n330h31n_.arc

Archive Log          155    24-MAY-25          /u01/app/oracle/fast_recovery_area/DB1/archivelog/2025_05_24/o1_mf_1_18_n33j24vq_.arc

Archive Log          156    24-MAY-25          /u01/app/oracle/fast_recovery_area/DB1/archivelog/2025_05_24/o1_mf_1_19_n33j2wbt_.arc

Archive Log          157    24-MAY-25          /u01/app/oracle/fast_recovery_area/DB1/archivelog/2025_05_24/o1_mf_1_20_n33o3c4t_.arc

Archive Log          194    24-MAY-25          /u01/app/oracle/fast_recovery_area/DB1/archivelog/2025_05_24/o1_mf_1_21_n33spson_.arc

Backup Set           199    24-MAY-25

  Backup Piece       200    24-MAY-25          /u01/app/oracle/fast_recovery_area/DB1/backupset/2025_05_24/o1_mf_annnn_TAG20250524T153347_n33spwhd_.bkp


Do you really want to delete the above objects (enter YES or NO)? YES

deleted archived log

archived log file name=/u01/app/oracle/fast_recovery_area/DB1/archivelog/2025_05_24/o1_mf_1_17_n330h31n_.arc RECID=12 STAMP=1201940579

deleted archived log

archived log file name=/u01/app/oracle/fast_recovery_area/DB1/archivelog/2025_05_24/o1_mf_1_18_n33j24vq_.arc RECID=13 STAMP=1201956550

deleted archived log

archived log file name=/u01/app/oracle/fast_recovery_area/DB1/archivelog/2025_05_24/o1_mf_1_19_n33j2wbt_.arc RECID=14 STAMP=1201956572

deleted archived log

archived log file name=/u01/app/oracle/fast_recovery_area/DB1/archivelog/2025_05_24/o1_mf_1_20_n33o3c4t_.arc RECID=15 STAMP=1201961707

deleted archived log

archived log file name=/u01/app/oracle/fast_recovery_area/DB1/archivelog/2025_05_24/o1_mf_1_21_n33spson_.arc RECID=16 STAMP=1201966425

deleted backup piece

backup piece handle=/u01/app/oracle/fast_recovery_area/DB1/backupset/2025_05_24/o1_mf_annnn_TAG20250524T153347_n33spwhd_.bkp RECID=42 STAMP=1201966428

Deleted 6 objects



RMAN>