Sunteți pe pagina 1din 7

oracle@#archive log list

if log mode is in nonarchivelog go for this step


Enabling archivelog mode
SQL> shutdown immediate;
SQL> startup mount exclusive;
SQL> alter database archivelog;
SQL> alter database open;
Now we can see that this database is in ARCHIVELOG mode:
SQL> select log_mode from v$database;
LOG_MODE
ARCHIVELOG
But automatic archival is disabled yet and DBA must do manual archival by
commands like the followings:
SQL> alter system archive log current;
SQL> alter system archive log all;
But this solution is not permanent and automatic archival will be disabled again
after restarting the database; so for permanent change we must set parameter
log_archive_start to TRUE:
SQL> alter system set log_archive_start=TRUE scope=spfile;
Disabling archivelog mode
To disabling ARCHIVELOG mode we must run the following commands:
SQL> alter system set log_archive_start=False scope=spfile;
SQL> create pfile from spfile;
SQL> shutdown immediate;

SQL> startup mount excluseve;

SQL> alter database noarchivelog;


SQL> alter database open;
Now we can check the status of ARCHIVELOG mode:
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination /archivelog
Oldest online log sequence 7194
Current log sequence 7195
3.Autobackup should be ON
(ex:Oracle@#./rman
RMAN>connect target /
RMAN>show all;
MAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO %F; #
default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO
/u01/app/oracle/product/9.2.0/dbs/snapcf_TARGDB.f

RMAN>configure controlfile autobackup ON;


4.Allocating a channel where the backup pieces can stored
run
{
ALLOCATE CHANNEL d1 device type disk format /tmp/%U;
backup database;
}
The backup pieces are stored in /tmp directory
Which contain two pieces one is for full backup and another is for controlfile (where
autobackup was on)
5.Check the DBID
sql>select dbid from v$database;
DBID
3386862614
Copy dbid
number and remember the sid
6.Now moving this two backup pieces to new machine at tmp directory
#scp -r
NEWMACHINE
1.First change the permission for tmp (ex:- oracle@#chown oracle tmp
and backup pieces too #chown oracle o1-c-1p33popo3po2p
#chown oracle 09opqucsdj)
2.export ORACLE_SID=dbase1
oracle@./rman
RMAN>connect target /

3.Set DBID
RMAN> set dbid 3386862614
executing command: SET DBID
4.RMAN> startup nomount
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file
/oracle/app/oracle/product/10.2.0/db_1/dbs/initdbase1.ora
starting Oracle instance without parameter file for retrival of spfile
Oracle instance started
Total System Global Area 159383552 bytes
Fixed Size 2019224 bytes
Variable Size 67108968 bytes
Database Buffers 83886080 bytes
Redo Buffers 6369280 bytes
5.Restore spfile to pfile.
RMAN> restore spfile to pfile
/oracle/app/oracle/product/10.2.0/db_1/dbs/initdbase1.ora from /tmp/o1_c00940ee34;
Starting restore at 06-MAY-08
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=36 devtype=DISK
channel ORA_DISK_1: autobackup found:
/oradata2/o1_mf_s_654016132_421c64vl_.bkp
channel ORA_DISK_1: SPFILE restore from autobackup complete
Finished restore at 06-MAY-08
6)start the instance with pfile.
Go to oracle@#cd /home/oracle/app/oracle/admin

then oracle@#mkdir dbase1


oracle@#cd dbase1
oracle@#mkdir adump
Give the full permissions to both directory
oracle@#chmod -R 777 dbase1
oracle@#chmod -R 777 adump
oracle@# chown oracle adump and dbase1
check the pfile from oracle@#cd /homeoracledbhome_1/dbs
oracle@#vi initdbase1.ora
check the audit_file_dest name is properly mentioned or not
It should match with ur current sid to check it follow below cmd
#grep -i audit_file_dest $ORACLE_HOME/dbs/*$ORACLE_SID.ora
RMAN> STARTUP FORCE NOMOUNT
PFILE=/oracle/app/oracle/product/10.2.0/db_1/dbs/initdbase1.ora;
Oracle instance started
Total System Global Area 209715200 bytes
Fixed Size 2019608 bytes
Variable Size 109055720 bytes
Database Buffers 92274688 bytes
Redo Buffers 6365184 bytes
If u get an error then call me..!!!9703762920
7)mkdir of sidname under /home/oracle/app..oradata/ and
/home..flash_recovery_area/
1)Give the permission to created directory
2)RMAN> RESTORE CONTROLFILE FROM /tmp/01-c0wllksl;
10)RMAN> ALTER DATABASE MOUNT;
database mounted

released channel: ORA_DISK_1


11)RMAN> list backup;

List of Backup Sets


===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
- - -
32 Full 525.67M DISK 00:01:31 06-MAY-08
BP Key: 33 Status: AVAILABLE Compressed: NO Tag: TAG20080506T150716
Piece Name: /oradata2/o1_mf_nnndf_TAG20080506T150716_421c355f_.bkp
List of Datafiles in backup set 32
File LV Type Ckp SCN Ckp Time Name
- - - 1 Full 745212 06-MAY-08 /oradata2/data1/dbase1/system01.dbf
2 Full 745212 06-MAY-08 /oradata2/data1/dbase1/undotbs01.dbf
3 Full 745212 06-MAY-08 /oradata2/data1/dbase1/sysaux01.dbf
4 Full 745212 06-MAY-08 /oradata2/data1/dbase1/users01.dbf
5 Full 745212 06-MAY-08 /oradata2/DBASE1/datafile/o1_mf_tbs2_41vyzfrq_.dbf
6 Full 745212 06-MAY-08 /oradata2/DBASE1/datafile/o1_mf_after_on_420r4f9h_.dbf
7 Full 745212 06-MAY-08 /oradata2/DBASE1/datafile/o1_mf_after_on_420r675z_.dbf
8 Full 745212 06-MAY-08 /oradata2/DBASE1/datafile/o1_mf_after_on_420x2yw8_.dbf
11)Make a script by issuing SET NEWNAME if you want different file name other than
source.
In the script issue SET UNTIL clause and restore and recover database.
Optional if u want you can
RMAN> run{
2> set newname for datafile 1 to /oradata2/DBase1/system01.dbf;

3> set newname for datafile 2 to /oradata2/DBase1/undotbs01.dbf;


4> set newname for datafile 3 to /oradata2/DBase1/sysaux01.dbf;
5> set newname for datafile 4 to /oradata2/DBase1/users01.dbf;
6> set newname for datafile 5 to /oradata2/DBase1/tbs201.dbf;
7> set newname for datafile 6 to /oradata2/DBase1/after_01.dbf;
8> set newname for datafile 7 to /oradata2/DBase1/after_02.dbf;
9> set newname for datafile 8 to /oradata2/DBase1/after_03.dbf;
10> set newname for datafile 1 to /oradata2/DBase1/system01.dbf;
12> SET UNTIL SCN 745212;
13> RESTORE DATABASE;
14> SWITCH DATAFILE ALL;
15> RECOVER DATABASE;
16> }
Mandatory
RAM>run{
SET UNTIL SCN 745212;
> RESTORE DATABASE;
> SWITCH DATAFILE ALL;
> RECOVER DATABASE;
>}
12)Open the Database resetlogs option.
RMAN> alter database open resetlogs;