Partial recovery of Oracle database using RMAN

Partial recovery of database using RMAN


For oracle DBA ,Their could be situations where application team can request to restore partial database up to a point in Time.. (Means few application tablespace). In todays blog , We will discuss about how we can resolve such situation.

Assumption is that we are doing partial database restore on the different server then production server.

Below are the steps , We are going to follow for partial recovery:

Step 1) Create pfile from spfile and make modifications as per the storage in New machine like the new disk group name etc.


more inittedtdb.ora
tedtdb.__db_cache_size=16240345088
tedtdb.__java_pool_size=67108864
tedtdb.__large_pool_size=67108864
tedtdb.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
tedtdb.__pga_aggregate_target=12884901888
tedtdb.__sga_target=19327352832
tedtdb.__shared_io_pool_size=0
tedtdb.__shared_pool_size=2415919104
tedtdb.__streams_pool_size=134217728
*._trace_files_public=TRUE
*.audit_file_dest='/u01/app/oracle/admin/tedtdb/adump'
*.audit_sys_operations=TRUE
*.audit_trail='DB'
*.cluster_database=false
*.compatible='11.2.0.0.0'
*.control_files='+DATA_CLONE/tedtdb/controlfile/current.ctl'
*.db_16k_cache_size=33554432
*.db_8k_cache_size=33554432
*.db_block_size=32768
*.db_cache_size=6815744000
*.db_create_file_dest='+DATA_CLONE'
*.db_create_online_log_dest_1='+DATA_CLONE'
*.db_create_online_log_dest_2='+DATA_CLONE'
*.db_domain=''
*.db_file_multiblock_read_count=128
*.db_files=10000
*.db_name='tedtdb'
*.db_recovery_file_dest='/orabackup/flash_recovery_area'
*.db_recovery_file_dest_size=107374182400000
*.db_securefile='ALWAYS'
*.db_writer_processes=4
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=tedtdbXDB)'
tedtdb1.instance_number=1
tedtdb2.instance_number=2
*.log_archive_dest_1='LOCATION=+DATA_CLONE'
*.log_archive_format='%t_%s_%r.dbf'
*.log_checkpoint_timeout=999999
*.log_checkpoints_to_alert=TRUE
*.log_file_name_convert='+REDO1','+DATA_CLONE','+REDO2','+DATA_CLONE'
*.O7_DICTIONARY_ACCESSIBILITY=FALSE
*.open_cursors=2000
*.os_authent_prefix=''
*.os_roles=FALSE
*.pga_aggregate_target=12884901888
*.processes=2000
*.remote_login_passwordfile='EXCLUSIVE'
*.remote_os_authent=FALSE
*.remote_os_roles=FALSE
*.sec_protocol_error_further_action='DELAY'
*.sessions=1105
*.sga_max_size=19327352832
*.sga_target=19327352832
*.shared_pool_size=2411724800
*.sql92_security=TRUE
tedtdb2.thread=2
tedtdb1.thread=1
*.undo_retention=86400
tedtdb1.undo_tablespace='UNDOTBS1'
tedtdb2.undo_tablespace='UNDOTBS2
db_file_name_convert=',"+DATA_TST'",'+DATA_CLONE'

Step 2 ) Below parameter needs to be changed OR added in pfile:- Only one instance to be started up.


*.cluster_database=false
*.tedtdb1.undo_tablespace='UNDOTBS1'
*.tedtdb2.undo_tablespace='UNDOTBS2
*.db_file_name_convert=',"+DATA_TST'",'+DATA_CLONE'
*.tedtdb1.instance_number=1
*.tedtdb2.instance_number=2
*.db_create_file_dest='+DATA_CLONE'
*.db_create_online_log_dest_1='+DATA_CLONE'
*.db_create_online_log_dest_2='+DATA_CLONE'
*.log_file_name_convert='+REDO1','+DATA_CLONE','+REDO2','+DATA_CLONE'

Step 3) Restore the control file and mount the database.

Step 4) Catalog the backup that is been copied to the machine.

Step 5) To find out mandatory tablespaces:


select distinct tablespace_name from dba_segments where owner in ('SYS','SYSTEM');

Mandatory ones are :- SYSTEM,SYSAUX,UNDO,USERS & the one you want to recover.

To find out the datafiles to be restored and create the set newname command in newly created disk group:

select 'set newname for datafile '''||file#||''' to '''||replace(name,'tedtdb1','+DATA_CLONE') ||''';' from v$datafile where ts#=49;

select 'set newname for tempfile '''||file#||''' to '''||replace(name,'tedtdb','+DATA_CLONE) ||''';' from v$tempfile;

Step 6) Restore Datafiles


run
{
set newname for datafile 88 to '+DATA_CLONE';
set newname for datafile 111 to '+DATA_CLONE';
set newname for datafile 113 to '+DATA_CLONE';
set newname for datafile 183 to '+DATA_CLONE';
set newname for datafile 1 to '+DATA_CLONE';
set newname for datafile 2 to '+DATA_CLONE';
set newname for datafile 5 to '+DATA_CLONE';
set newname for datafile 244 to '+DATA_CLONE';
set newname for datafile 3 to '+DATA_CLONE';
set newname for datafile 4 to '+DATA_CLONE';
set newname for datafile 6 to '+DATA_CLONE';
set newname for datafile 7 to '+DATA_CLONE';
set newname for datafile 8 to '+DATA_CLONE';
set newname for tempfile 1 to '+DATA_CLONE';
set newname for tempfile 2 to '+DATA_CLONE';
set newname for tempfile 3 to '+DATA_CLONE';
set newname for tempfile 4 to '+DATA_CLONE';
set newname for tempfile 5 to '+DATA_CLONE';
restore datafile 88;
restore datafile 111;
restore datafile 113;
restore datafile 183;
restore datafile 1;
restore datafile 2;
restore datafile 5;
restore datafile 244;
restore datafile 3;
restore datafile 4;
restore datafile 6;
restore datafile 7;
restore datafile 8;
restore tempfile 1;
restore tempfile 2;
restore tempfile 3;
restore tempfile 4;
restore tempfile 5;
switch datafile all;
switch tempfile all;
}

Step 7) Recover database until require time

run
{
set until time "to_date('16-11-2021 15:30:00','dd-mm-yyyy hh24:mi:ss')";
recover database SKIP FOREVER TABLESPACE TS_ETLREF_IDX_ALL,TS_BAS_WEBAPP_DTA_ALL,TS_BAS_TXN_DTA_2009,TS_ANL_TXN_IDX_2008,TS_BAS_TXN_DTA_2008,TS_ANL_MST_DTA_ALL,TS_ANL_TXN_DTA_ALL,TS_ANL_MVS_DTA_ALL,TS_ANL_MST_IDX_ALL,TS_ANL_TXN_IDX_ALL,TS_ANL_MVS_IDX_ALL,TS_ANL_TXN_DTA_2011,TS_BAS_TXN_DTA_MINVAL,TS_ANL_TXN_DTA_2010,TS_ANL_TXN_IDX_2009,TS_ANL_TXN_IDX_2010,TS_ANL_TXN_DTA_2009,TS_ANL_TXN_IDX_2011,TS_ANL_TXN_DTA_2008,TS_ANL_TXN_DTA_MAXVAL,TS_ANL_TXN_DTA_MINVAL,TS_BAS_TXN_IDX_2008,TS_BAS_TXN_IDX_2009,TS_BAS_TXN_IDX_2010,TS_BAS_TXN_IDX_2011,TS_SOX_MST_DTA_ALL,TS_BAS_TXN_DTA_2012,TS_BAS_TXN_IDX_2012,TS_BAS_TXN_DTA_MAXVAL,OGG_TBS,TS_BAS_RM_DTA_ALL,TS_BAS_RM_IDX_ALL,TS_ANL_TXN_DTA_2012,TS_ANL_TXN_IDX_2012,TS_BAS_WEBAPP_IDX_ALL,TS_ANL_TXN_DTA_2013;
}

Step 8) open database with resetlogs.


Comments

Popular posts from this blog

Restore MySQL Database from mysqlbackup

Oracle 19c New Features

Install & Configure MySQL Router - MySQL InnoDB Cluster