1. Creating and mounting new snapshot
[oracle]$
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/19.0/grid
/sbin/acfsutil snap create -w rw_bank /u02/oradata/bank
/sbin/acfsutil snap link -s rw_bank /u02/oradata/bank/rw_bank
### info
acfsutil snap info /u02/oradata/bank
### drop
### /sbin/acfsutil snap delete rw_bank /u02/oradata/bank
2. Starting database "Zero Snapshot"
[oracle]$
export ORACLE_SID=rw_bank
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/19.0/dbhome_1
$ORACLE_HOME/bin/sqlplus '/ as sysdba' <<EOF
startup mount;
alter database flashback off;
EOF
### info
set lin 5000 pages 5000;
show parameter control;
SQL> show parameter control_files;
NAME TYPE VALUE
----------------------- ----------- ------------------------------
control_files string /u02/oradata/bank/rw_bank/control01.ctl
3. Replacing paths for files to patch: /u02/oradata/bank/rw_bank/
[oracle]$
$ORACLE_HOME/bin/sqlplus '/ as sysdba' <<EOF
begin
FOR z IN
(select 'alter database rename file '''||name||''' to ''/u02/oradata/bank/rw_bank/'||substr(name,instr(name,'/',-1)+1)||'''' name from
(select name from v\$datafile union
select name from v\$tempfile union
select member name from v\$logfile) order by 1)
LOOP
begin
execute immediate z.name;
exception when others then NULL;
end;
END LOOP;
end;
/
EOF
4. Сhecking file location
[oracle]$
$ORACLE_HOME/bin/sqlplus '/ as sysdba' <<EOF
set lin 5000;
select distinct substr(replace(name,'\','/'),1,instr(replace(name,'\','/'),'/',-1)),count(*) from (
select name from v\$datafile union
select name from v\$tempfile union
select member from v\$logfile union
select name from v\$controlfile
union select name from V\$FLASHBACK_DATABASE_LOGFILE
) group by substr(replace(name,'\','/'),1,instr(replace(name,'\','/'),'/',-1))
order by 1;
EOF
5. Activating and open database
[oracle]$
$ORACLE_HOME/bin/sqlplus '/ as sysdba' <<EOF
alter database activate standby database;
shutdown immediate;
startup mount;
alter database set standby to maximize performance;
alter database noarchivelog;
alter database no force logging;
alter database open;
EOF
6. Shutdown database;
[oracle]$
$ORACLE_HOME/bin/sqlplus '/ as sysdba' <<EOF
shutdown immediate;
EOF
No comments:
Post a Comment