Skip to main content

rman delete backup without mounting db

########################################################
Description :
BIDTST database is accidently dropped before it's RMAN database backups on tapes are removed.
so we need to remove the backups without having BIDTST db mounted.
The doc retains the error messages which help troubleshooting...

Date : June 1, 2011
DBA : Jiulu Sun & Kevin Ma
########################################################

$ rman catalog rman/password@catalog target /

Recovery Manager: Release 10.2.0.4.0 - Production on Thu Jun 2 15:26:52 2011

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

connected to target database: DUMMY (not mounted)
connected to recovery catalog database

RMAN> @generic_config.rman

RMAN> configure channel device type sbt parms 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo_rman_agcoux043.opt)';
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of configure command at 06/02/2011 15:27:01
RMAN-06004: ORACLE error from recovery catalog database: RMAN-20001: target database not found in recovery catalog

RMAN> CONFIGURE DEFAULT DEVICE TYPE TO 'SBT_TAPE';
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of configure command at 06/02/2011 15:27:01
RMAN-06004: ORACLE error from recovery catalog database: RMAN-20001: target database not found in recovery catalog

...

RMAN> set dbid=989504976

executing command: SET DBID
database name is "BIDTST" and DBID is 989504976

RMAN> @generic_config.rman

RMAN> configure channel device type sbt parms 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo_rman_agcoux043.opt)';
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of configure command at 06/02/2011 15:27:21
ORA-01507: database not mounted <-- you cannot configure anything if the db is not mounted.
...
RMAN> **end-of-file**

RMAN> list backup summary; <-- but you still can list backup


List of Backups
===============
Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
105378 B 0 A SBT_TAPE 20100819-21:54 1 1 YES TAG20100819T213534
254877 B F A SBT_TAPE 20110508-18:44 1 1 NO TAG20110508T184450

RMAN> restore controlfile; <-- now we are able to restore the controlfile.

Starting restore at 20110602-15:30
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=39 devtype=DISK

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 06/02/2011 15:30:12
RMAN-06026: some targets not found - aborting restore
RMAN-06101: no channel to restore a backup or copy of the control file

I shutdown the db and removed the controlfile, startup nomount the dummy db again, those output is not included here...

RMAN> run {
2> allocate channel t1 type 'sbt_tape' parms 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo_rman_agcoux043.opt)';
3> restore controlfile; <-- we are able to restore control file
4> }

released channel: ORA_DISK_1
allocated channel: t1
channel t1: sid=39 devtype=SBT_TAPE
channel t1: Data Protection for Oracle: version 5.4.1.0

Starting restore at 20110602-15:31

channel t1: starting datafile backupset restore
channel t1: restoring control file
channel t1: reading from backup piece c-989504976-20110508-01
channel t1: restored backup piece 1
piece handle=c-989504976-20110508-01 tag=TAG20110508T184450
channel t1: restore complete, elapsed time: 00:00:03
output filename=/oracle/10.2.0/dbs/cntrlBIDTST.dbf
Finished restore at 20110602-15:32
released channel: t1

RMAN> shutdown immediate

Oracle instance shut down

RMAN> startup force nomount; <-- startup a dummy database without a spfile

startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/oracle/10.2.0/dbs/initBIDTST.ora'

starting Oracle instance without parameter file for retrival of spfile
Oracle instance started

Total System Global Area 159383552 bytes

Fixed Size 2082504 bytes
Variable Size 67111224 bytes
Database Buffers 83886080 bytes
Redo Buffers 6303744 bytes

RMAN> set dbid=989504976;

executing command: SET DBID
database name is "BIDTST" and DBID is 989504976

RMAN> run {
2> allocate channel t1 type 'sbt_tape' parms 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo_rman_agcoux043.opt)';
3> crosscheck backup; <-- we are able to crosscheck backup with the dummy nomount database
4> }

allocated channel: t1
channel t1: sid=36 devtype=SBT_TAPE
channel t1: Data Protection for Oracle: version 5.4.1.0

crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=v1llot17_1_1 recid=1105 stamp=727479335
crosschecked backup piece: found to be 'AVAILABLE'
...
Crosschecked 184 objects

released channel: t1

RMAN> drop database;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
ORA-01507: database not mounted <<-- however, we cannot drop database because it's not mounted

RMAN> run {
2> allocate channel t1 type 'sbt_tape' parms 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo_rman_agcoux043.opt)';
3> delete backup; <-- now let's delete the tape backup with the nomount dummy db
4> }

allocated channel: t1
channel t1: sid=36 devtype=SBT_TAPE
channel t1: Data Protection for Oracle: version 5.4.1.0


List of Backup Pieces
BP Key BS Key Pc# Cp# Status Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
105387 105378 1 1 AVAILABLE SBT_TAPE v1llot17_1_1
105388 105379 1 1 AVAILABLE SBT_TAPE uullot17_1_1
...
254879 254877 1 1 AVAILABLE SBT_TAPE c-989504976-20110508-01

Do you really want to delete the above objects (enter YES or NO)? yes
\^Hdeleted backup piece
backup piece handle=v1llot17_1_1 recid=1105 stamp=727479335
...
Deleted 184 objects

released channel: t1

RMAN> list backup summary;
<-- nothing left

RMAN>

Comments

Popular posts from this blog

non-existent process lock port on windows server

I have a database link created between oracle and sqlserver using oracle tg4odbc, the product is installed on windows server and run as service "OracleOraGtw11g_home1TNSListener", but sometime the service cannot started, the root cause of this problem is that the port number 1521 is used by an non-existent process. The first step is to use netstat -bano|find "1521" to get the process id, in my case it's 5844, which shows the connection is from my oracle server 10.8.0.169 H:\>netstat -bano|find "1521"   TCP    0.0.0.0:1521           0.0.0.0:0              LISTENING       5844   TCP    10.14.45.33:1521       10.8.0.169:42987       ESTABLISHED     5844 however the process id does not show in either task manager or process explorer. The next step is to run tcpview, which shows non-existent under process column, there are three rows, two show status as "listening", the other one shows status "established", right click and k

Opatch apply/lsinventory error: oneoff is corrupted or does not exist

I am applying the quarterly patch for 19c RDBMS, I tried using napply but failed, but somehow it corrupted the inventory though nothing applied. further apply and lsinventory command ran into error like this: $ ./OPatch/opatch lsinventory Oracle Interim Patch Installer version 12.2.0.1.21 Copyright (c) 2020, Oracle Corporation.  All rights reserved. Oracle Home       : /u02/app/oracle/19.0.0 Central Inventory : /u01/app/oraInventory    from           : /u02/app/oracle/19.0.0/oraInst.loc OPatch version    : 12.2.0.1.21 OUI version       : 12.2.0.7.0 Log file location : /u02/app/oracle/19.0.0/cfgtoollogs/opatch/opatch2020-09-08_13-35-59PM_1.log Lsinventory Output file location : /u02/app/oracle/19.0.0/cfgtoollogs/opatch/lsinv/lsinventory2020-09-08_13-35-59PM.txt -------------------------------------------------------------------------------- Inventory load failed... OPatch cannot load inventory for the given Oracle Home. LsInventorySession failed: Unable to create patchObject Possible ca

shell script to clean up oracle dumpfile

https://github.com/iacosta/personal/blob/master/shells/cleanhouse.sh #!/bin/ksh # # Script used to cleanup any Oracle environment. # # Cleans:      audit_file_dest #              background_dump_dest #              core_dump_dest #              user_dump_dest #              Clusterware logs # # Rotates:     Alert Logs #              Listener Logs # # Scheduling:  00 00 * * * /networkdrive/dba/scripts/purge/cleanup.sh -d 7 > /u01/dba/bin/cleanup.log 2>&1 # # Created By:  Lei Dao # # # RM="rm -f" RMDIR="rm -rf" LS="ls -l" MV="mv" TOUCH="touch" TESTTOUCH="echo touch" TESTMV="echo mv" TESTRM=$LS TESTRMDIR=$LS SUCCESS=0 FAILURE=1 TEST=0 HOSTNAME=`hostname` ORAENV="oraenv" TODAY=`date +%Y%m%d` ORIGPATH=/usr/local/bin:$PATH ORIGLD=$LD_LIBRARY_PATH export PATH=$ORIGPATH # Usage function. f_usage(){   echo "Usage: `basename $0` -d DAYS [-a DAYS] [-b DAYS] [