Monday, May 23, 2016

rman shell script but not connecting to recovery catalog

I have one RMAN backup script works fine , but when running for a 12c.1 database, it keeps showing me below in logfile

"using target database control file instead of recovery catalog
Report of database schema for database with db_unique_name DEV"


And this the working fine shell function.


func_cold_db_backup() {
${ORACLE_HOME}/bin/rman target /  cmdfile='/oracle/UAT/ops/exec/cold_backup.rman' log=$logfile <>$logfile 2>&1
${ORACLE_HOME}/bin/rman target /   log=$logfile <>$logfile 2>&1
connect catalog rman/pwdxxxxx@RCAT
@/oracle/UAT/ops/exec/cold_backup.rman
EOF


When manually try the command , it works fine and shows me connected to RCAT.

${ORACLE_HOME}/bin/rman target /  catalog rman@RCAT
connected to target database: UAT (DBID=27281018)
connected to recovery catalog database


So the only difference is cmdfile parameter.

As such, I rewrite the function and works "better" now for this database.


func_cold_db_backup() {
${ORACLE_HOME}/bin/rman target /   log=$logfile <>$logfile 2>&1
connect catalog rman/pwdxxx@RCAT
@/oracle/UAT/ops/exec/cold_backup.rman
EOF

Friday, May 13, 2016

two ways to decommission a database backed up by RMAN

1. If follow proper procedure, backups should be deleted before unregistrating from recovery catalog

Either using with RMAN command "delete backup", or
during dropping database with "drop database including backups"

2. However, if we forget to follow above sequence, we still have manual way to achieve the same.

2.1  Manually delete backups from DISK, usually they should be under FRA.
2.2 Connect to catalog database without specifying target

     rman rman/password@RCAT

    > set dbid=
    > unregister database;



e.g.




> rman  catalog rman@RCAT

Recovery Manager: Release 11.2.0.3.0 - Production on Fri May 13 15:20:03 2016

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

recovery catalog database Password:
connected to recovery catalog database

RMAN> set dbid=649569281;

executing command: SET DBID
database name is "CTCG" and DBID is 649569281

RMAN> unregister database;

database name is "CTCG" and DBID is 649569281

Do you really want to unregister the database (enter YES or NO)? yes
database unregistered from the recovery catalog

RMAN> exit



double-quoted not accept in 10g rman, but not 11g

In my cold backup shell script, there is below line, which works fine in 11g.

A double quote inside single quote , to pass ORACLE_HOME path  to &1 of cold_backup.rman

${ORACLE_HOME}/bin/rman target /  cmdfile='./cold_backup.rman "/software/oraabc/product/11.2.0"' log=$logfile <>$logfile 2>&1
connect catalog rman/xxxxxx@RCAT1
EOF

But it is giving me below error , when running for 10g database.


Both single and double quotes (' or ") are accepted for a quoted-string.
Quotes are not required unless the string contains embedded white-space.

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00552: syntax error in command line arguments
RMAN-01009: syntax error: found "double-quoted-string": expecting one of: "append, at, auxiliary, catalog, cmdfile, clone, checksyntax, debug, log, msglog, mask, msgno, nocatalog, pipe, rcvcat, script, slaxdebug, send, target, timeout, trace"
RMAN-01007: at line 0 column 52 file: command line arguments
Recovery Manager: Release 10.2.0.2.0 - Production on Wed May 11 15:57:27 2016

This is a funny finding.

Tuesday, May 10, 2016

NFS error in AIX when running RMAN backup to disk

channel ORA_DISK_1 disabled, job failed on it will be run on another channel
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on ORA_DISK_2 channel at 05/04/2016 21:01:22
ORA-19504: failed to create file "/dbfra/testdb11d/bbbb/BBBB/backupset/2016_05_04/o1_mf_nnndf_TAG20160504T210121_%u_.bkp"
ORA-27054: NFS file system where the file is created or resides is not mounted with correct options
Additional information: 5
Additional information: 9


although the file system is presented in /etc/filesystems file.

/dbfra:
        dev             = "/dbfra"
        vfs             = nfs
        nodename        = 10.149.90.205
        mount           = true
        options         = bg,soft,intr,rsize=32768,wsize=32768,proto=tcp,sec=sys
        account         = false



resolved by add below parameter to pfile.

echo 'event="10298 trace name context forever, level 32"'  >>initBBBB.ora

Thursday, April 28, 2016

RMAN-06059: expected archived log not found

manually deleted some files, and when backup archived log files using RMAN,


Starting backup at 2016-APR-27 11:33:09
current log archived
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=160 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=162 device type=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 04/27/2016 11:33:29
RMAN-06059: expected archived log not found, loss of archived log compromises recoverability
ORA-19625: error identifying file /cc014/oraarch/TESTDB/TESTDB_0001_761215983_43224.arc
ORA-27037: unable to obtain file status
HPUX-ia64 Error: 2: No such file or directory
Additional information: 3


issued ,

RMAN> crosscheck archivelog all;

released channel: ORA_DISK_1
released channel: ORA_DISK_2
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=303 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=160 device type=DISK
validation succeeded for archived log
archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_57463.arc RECID=57445 STAMP=908551327
validation succeeded for archived log
archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_57464.arc RECID=57446 STAMP=908551336
validation succeeded for archived log
archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_57465.arc RECID=57447 STAMP=908551347
validation succeeded for archived log
archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_57466.arc RECID=57448 STAMP=908551357
validation succeeded for archived log
archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_57467.arc RECID=57449 STAMP=908551366
validation succeeded for archived log
archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_57468.arc RECID=57450 STAMP=908551377
validation succeeded for archived log
archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_57469.arc RECID=57451 STAMP=908551384
validation succeeded for archived log
archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_57470.arc RECID=57452 STAMP=908551390
validation succeeded for archived log
archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_57471.arc RECID=57453 STAMP=908551398
validation succeeded for archived log
archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_57472.arc RECID=57454 STAMP=908551404
...

archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_47965.arc RECID=47947 STAMP=843054910
validation failed for archived log
archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_47966.arc RECID=47948 STAMP=843054994
validation failed for archived log
archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_47967.arc RECID=47949 STAMP=843058390
validation failed for archived log
archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_47968.arc RECID=47950 STAMP=843058474
validation failed for archived log
archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_47969.arc RECID=47951 STAMP=843058505
validation failed for archived log
archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_47970.arc RECID=47952 STAMP=843058591
validation failed for archived log
archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_47971.arc RECID=47953 STAMP=843062002
validation failed for archived log
archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_47972.arc RECID=47954 STAMP=843062090
validation failed for archived log
archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_47973.arc RECID=47955 STAMP=843062111
validation failed for archived log
archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_47974.arc RECID=47956 STAMP=843062196
validation failed for archived log
archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_47975.arc RECID=47957 STAMP=843065605
validation failed for archived log
archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_47976.arc RECID=47958 STAMP=843065687
validation failed for archived log
archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_47977.arc RECID=47959 STAMP=843065782
validation failed for archived log
archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_47978.arc RECID=47960 STAMP=843065802
validation failed for archived log

...
archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_57456.arc RECID=57438 STAMP=908491636
validation failed for archived log
archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_57457.arc RECID=57439 STAMP=908500971
validation failed for archived log
archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_57458.arc RECID=57440 STAMP=908502821
validation failed for archived log
archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_57459.arc RECID=57441 STAMP=908506176
validation failed for archived log
archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_57460.arc RECID=57442 STAMP=908508642
validation failed for archived log
archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_57461.arc RECID=57443 STAMP=908521666
validation failed for archived log
archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_57462.arc RECID=57444 STAMP=908538814
Crosschecked 14239 objects

For record type DELETED OBJECT RECIDS from 2 to 3 are re-used before resync


Now continue the backup for archived log files.


Wednesday, April 27, 2016

Ubuntu Hibernate button

Like to use the suspend/Hibernate function of Ubuntu, which saves me time from Bootup.

It find this is in gnome flashback(Metachity) session.only. Would like to try other Gnome new desktop session, but didn't switch to, due to lacking of the hibernate button.

Googled and finally find it is there, just need to press ALT button, and the power off icon becomes PAUSE icon, which means suspend/Hibernate.



Later on, I also find my favorite taskbar / panel by configure it with gnome-tweak-tool

solutions for handling RMAN-08138

configured
"CONFIGURE ARCHIVELOG DELETION POLICY TO BACKED UP 2 TIMES TO DISK;  "


when

RMAN> delete noprompt archivelog until time 'sysdate-14';

starting full resync of recovery catalog
full resync complete
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=156 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=279 device type=DISK
RMAN-08138: WARNING: archived log not deleted - must create more backups
archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_43224.arc thread=1 sequence=43224
RMAN-08138: WARNING: archived log not deleted - must create more backups
archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_43225.arc thread=1 sequence=43225
RMAN-08138: WARNING: archived log not deleted - must create more backups
archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_43226.arc thread=1 sequence=43226
RMAN-08138: WARNING: archived log not deleted - must create more backups
archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_43227.arc thread=1 sequence=43227
RMAN-08138: WARNING: archived log not deleted - must create more backups
archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_43228.arc thread=1 sequence=43228
RMAN-08138: WARNING: archived log not deleted - must create more backups


We can also notice those archive log files are marked as X (expired).

457433  1    50363   X 2014-AUG-04 21:55:02
        Name: /cc014/oraarch/TESTDB/TESTDB_0001_761215983_50363.arc

457434  1    50364   X 2014-AUG-04 21:56:31
        Name: /cc014/oraarch/TESTDB/TESTDB_0001_761215983_50364.arc

457435  1    50365   X 2014-AUG-04 22:32:17
        Name: /cc014/oraarch/TESTDB/TESTDB_0001_761215983_50365.arc

457436  1    50366   X 2014-AUG-04 22:53:36
        Name: /cc014/oraarch/TESTDB/TESTDB_0001_761215983_50366.arc

457437  1    50367   X 2014-AUG-04 22:55:08
        Name: /cc014/oraarch/TESTDB/TESTDB_0001_761215983_50367.arc

457438  1    50368   X 2014-AUG-04 22:56:33
        Name: /cc014/oraarch/TESTDB/TESTDB_0001_761215983_50368.arc

457439  1    50369   X 2014-AUG-04 23:51:36


since those files are manually purged and no longer on disk, my workaround for this test database is to temporally clear the archivelog deletion policy.

CONFIGURE ARCHIVELOG DELETION POLICY CLEAR;


Then, re-execute the command again, which went through.

archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_57460.arc RECID=57442 STAMP=908508642
deleted archived log
archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_57461.arc RECID=57443 STAMP=908521666
deleted archived log
archived log file name=/cc014/oraarch/TESTDB/TESTDB_0001_761215983_57462.arc RECID=57444 STAMP=908538814
Deleted 14239 objects



Now , I can enable the deletion policy again.

CONFIGURE ARCHIVELOG DELETION POLICY TO BACKED UP 2 TIMES TO DISK;  



Believe below two methods also work which I googled.

http://oraclehariprasathdba.blogspot.sg/2013/02/how-to-force-oracle-rman-to-delete-all.html

delete force archivelog all;

http://oraclebyravi.blogspot.sg/2013/08/rman-08138-warning-archived-log-not.html

delete noprompt expired archivelog all;