ln -s /ora/dgbbcrd pgbbcrd
ln -s /ora/dgbbcrdm pgbbcrdm

dmotdbb1:/ora dgbbc 10:34:41 $ ls -lrt

shutdown immediate;

startup mount exclusive restrict;

drop database;


shutdown abort;

-- Change DB name in init to pgbbc

db_name and instance_name parameters


create spfile from pfile;


startup nomount;
restore controlfile from '/rman/dgbbc/PGBBC/c-1233168018-20200120-01';

alter database mount;

catalog start with '/rman/dgbbc/PGBBC/';

alter database flashback off;

alter database set standby database to maximize performance;

run
{
set newname for datafile 1 to '/ora/dgbbcdb/system_01.dbf';
set newname for datafile 2 to '/ora/dgbbcdb/undo_01.dbf';
set newname for datafile 3 to '/ora/dgbbcdb/sysaux_01.dbf';
set newname for datafile 4 to '/ora/dgbbcdb/users_01.dbf';
set newname for datafile 5 to '/ora/dgbbcdb/dbm_m_01.dbf';
set newname for datafile 6 to '/ora/dgbbcin/dbm_s_index_01.dbf';
set newname for datafile 7 to '/ora/dgbbcdb/stoc_01.dbf';
set newname for datafile 8 to '/ora/dgbbcdb/stoc_ic_01.dbf';
set newname for datafile 9 to '/ora/dgbbcin/hyperc_medium_ind.dbf';
set newname for datafile 10 to '/ora/dgbbcdb/hyperc_medium_tab.dbf';
set newname for datafile 11 to '/ora/dgbbcin/hyperc_small_ind.dbf';
set newname for datafile 12 to '/ora/dgbbcdb/hyperc_small_tab.dbf';
set newname for datafile 13 to '/ora/dgbbcin/stoc_ic_02.dbf';
set newname for datafile 14 to '/ora/dgbbcdb/stoc_02.dbf';
set newname for tempfile 1 to '/ora/dgbbcdb/temp_01.dbf';
restore database;
SWITCH DATAFILE ALL;
SWITCH TEMPFILE ALL;
recover database;
}

alter database open resetlogs;

alter user sys identified by Blu3;

shutdown immediate;

startup mount restrict;

nid target=sys/Blu3 dbname=dgbbc setname=yes

create pfile from spfile;

-- Change DB name in init

create spfile from pfile;


orapwd file=orapwdgbbc password=Blu3 ignorecase=n force=y

shutdown immediate

startup

Deal with issues with Redo Log File Cloning

SQL> alter database rename file 'FILE NAME WITH FULL PATH' TO 'FILE NAME WITH NEW PATH';

SQL> select 'alter database rename file '||member||' to '||member||';'
     from v$logfile
     where type = 'ONLINE';

SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-00392: log 1 of thread 1 is being cleared, operation not allowed
ORA-00312: online log 1 thread 1: '/ora/tgbbcrd/redo_0101.log'
ORA-00312: online log 1 thread 1: '/ora/tgbbcrdm/redo_0101.log'

SQL> alter database open resetlogs;
Database altered.

SQL> alter database clear unarchived logfile group 1 ;
alter database clear unarchived logfile group 2 ;
alter database clear unarchived logfile group 3 ;

SQL> alter database open resetlogs;

Database altered.

	
nid target=sys/Blu3 revert=Y