Showing posts with label rman oracle. Show all posts
Showing posts with label rman oracle. Show all posts

Friday, October 28, 2011

Oracle Database Cloud Backup to Amazon S3 using osbws

After registering with S3 check to ensure your S3 bucks are available.
I created 2 buckets 1 for the log and 1 for data.
oracle-data--1
oracle-log--1

Ensure your database server can access s3.amazonaws.com
>nslookup s3.amazonaws.com

Non-authoritative answer:
s3.amazonaws.com canonical name = s3-1.amazonaws.com.
Name: s3-1.amazonaws.com
Address: 72.21.203.145

Ensure you have java installed on your database server
java -version
java version "1.6.0_27"
Java(TM) SE Runtime Environment (build 1.6.0_27-b07)
Java HotSpot(TM) 64-Bit Server VM (build 20.2-b06, mixed mode)

Download osbws_install.jar from otn.oracle.com

Create argFile , I called it awsrman
-AWSID -AWSKEY -otnUser -otnPass < yourOTNpassword> -walletDir /home/oracle/script/wallet -libDir /home/oracle/script -debug

java -jar osbws_install.jar -argFile ./awsrman

Here is the output from the jar install
Oracle Secure Backup Database Web-Service Install Tool, build 2011-02-04.0001
Debug: os.name = Linux
Debug: os.arch = amd64
Debug: os.version = 2.6.18-194.el5
Debug: file.separator = /
Debug: S3 ID:
Debug: S3 Key:
Debug: AWS Success, owner=sthenmoz, id=
AWS credentials are valid.
Debug: Platform = PLATFORM_LINUX64
S3 user already registered.
Registration ID:
S3 Logging Bucket: oracle-log--1
Validating log bucket location ...
Debug: Get location HTTP response: 200 - OK
Debug: log bucket location = []
Validating license file ...
Debug: Get license file HTTP response: 200 - OK
Create credential oracle.security.client.connect_string1
OSB web-services wallet created in directory /home/oracle/script/wallet.
OSB web-services initialization file /opt/oracle/product/10.2.0/db_1/dbs/osbwsTST10G.ora created.
Downloading OSB Web Services Software Library from file osbws_linux64.zip.
Debug: Temp zip file = /tmp/osbws_linux644610275856950839391.zip
Downloaded 16350454 bytes in 10 seconds. Transfer rate was 1635045 bytes/second.
Download complete.
Extracted file /home/oracle/script/libosbws11.so
Debug: Delete RC = true

Created a script to configure rman and placed in configure.rcv
configure CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS 'SBT_LIBRARY=/home/oracle/script/libosbws11.so ENV=(OSB_WS_PFILE=/opt/oracle/product/10.2.0/db_1
/dbs/osbwsTST10G.ora)';


rman target / @configure.rcv

Output
RMAN> configure CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS 'SBT_LIBRARY=/home/oracle/script/libosbws11.so ENV=(OSB_WS_PFILE=/opt/oracle/product/10.2.0/db_1/dbs/osbwsTST10G.ora)';
using target database control file instead of recovery catalog
new RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS 'SBT_LIBRARY=/home/oracle/script/libosbws11.so ENV=(OSB_WS_PFILE=/opt/oracle/product/10.2.0/db_1/dbs/osbwsTST10G.ora)';
new RMAN configuration parameters are successfully stored

show all;
CONFIGURE DEFAULT DEVICE TYPE TO 'SBT_TAPE';
CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS 'SBT_LIBRARY=/home/oracle/script/libosbws11.so ENV=(OSB_WS_PFILE=/opt/oracle/product/10.2.0/db_1ee/dbs/osbwsTST10G.ora)';



RMAN> backup as compressed backupset database include current controlfile plus archivelog;

Tuesday, February 24, 2009

Restore and Recover Inconsistent rman backup

Have you ever had to restore an oracle database when you did not have all the archived redo logs that occurred during the backup? Well I did and it was an interesting day that required an escalated SR to oracle support. Here is how I recovered.

I restored the tape backup using rman and a backup of the snapshot control file found in my $ORACLE_HOME/dbs directory.

cp $ORACLE_HOME/dbs/snapcf_mydb.f /ora01/mydb.ctl

I mounted the controlfile
startup mount

I connected to rman
rman target /

I restored my inconsistent backup
restore database;

I tried to recover my database but could not since I am missing archived redo logs during the backup.
recover database;

I tried opening the database with alter database resetlogs but could not since system datafile was inconsistent.

I changed init.ora parameter to add the following parameters per Oracle Support recommendation and then restarted the database in mount mode.
_ALLOW_RESETLOGS_CORRUPTION = TRUE
_minimum_giga_scn=6884
_allow_error_simulation=true
_CORRUPTED_ROLLBACK_SEGMENTS=(_SYSSMU1$,_SYSSMU2$, _SYSSMU3$,_SYSSMU4$, _SYSSMU5$,_SYSSMU6$,_SYSSMU7$, _SYSSMU8$,_SYSSMU9$, _SYSSMU10$,SYSSMU11$,_SYSSMU12$,_SYSSMU13$,_SYSSMU14$,_SYSSMU15$, _SYSSMU16$,_SYSSMU17$, _SYSSMU18$,_SYSSMU19$,_SYSSMU20$,_SYSSMU21$, SYSSMU22$,_SYSSMU23$,_SYSSMU24$, _SYSSMU25$, _SYSSMU26$,_SYSSMU27$,_SYSSMU28$,_SYSSMU29$, _SYSSMU30$,_SYSSMU31$)
undo_management=manual

In sqlplus I could then do
alter database open resetlogs;

I then created a shell database using dbca

I then exported the full database using
exp system/manager full=y file=full.dmp log=full.log

Next I imported my full export into my new shell database
imp system/manager file=full.dmp log=impfull.log commit=y ingore=yes destroy=no

I then put the new database in archivelog mode so I do not have this problem again.
shutdown immediate;
startup mount;
alter database archivelog;
alter database open;

I then created a full backup and archive log backups through grid control.