Backup Restore 123 Linux

 

 

Table of Contents

Backup Restore 123 Linux. 1

Podici bazu spfile. 1

Konekcija RMAN, restore controlfile. 1

Mountuj bazu restorovanim controlfile. 1

Restore, Recover baze. 1

Otvoriti bazu resetlogs. 1

Napraviti novi backup. 1

 

 

 

Podici bazu spfile

SQL> startup nomount

 

Konekcija RMAN, restore controlfile

 

rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Mon Sep 11 01:49:40 2023

Version 19.20.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

connected to target database: CDB1 (not mounted)

RMAN> set DBID=1118747042;

RMAN> restore controlfile from autobackup validate;

 

Starting restore at 11-SEP-23

using channel ORA_DISK_1

 

channel ORA_DISK_1: looking for AUTOBACKUP on day: 20230911

channel ORA_DISK_1: AUTOBACKUP found: c-1118747042-20230911-00

channel ORA_DISK_1: starting validation of datafile backup set

channel ORA_DISK_1: validation complete, elapsed time: 00:00:01

Finished restore at 11-SEP-23

 

RMAN> restore controlfile from autobackup; 

 

Mountuj bazu restorovanim controlfile

 

RMAN> alter database mount;

 

Restore, Recover baze

RMAN> restore database validate; 

Finished restore at 11-SEP-23

 

RMAN> run {

#SET UNTIL TIME="TO_DATE('2023-08-13 01:00:00','YYYY-MM-DD HH24:MI:SS')";

restore database;

recover database;

}

 

Starting restore at 11-SEP-23

using channel ORA_DISK_1

using channel ORA_DISK_2

 

skipping datafile 5; already restored to file /u02/oradata/CDB1/pdbseed/system01.dbf

skipping datafile 8; already restored to file /u02/oradata/CDB1/pdbseed/undotbs01.dbf

skipping datafile 6; already restored to file /u02/oradata/CDB1/pdbseed/sysaux01.dbf

channel ORA_DISK_1: starting datafile backup set restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set

channel ORA_DISK_1: restoring datafile 00003 to /u02/oradata/CDB1/sysaux01.dbf

channel ORA_DISK_1: restoring datafile 00004 to /u02/oradata/CDB1/undotbs01.dbf

channel ORA_DISK_1: reading from backup piece /home/oracle/backup/0i2629nj_18_1_1

channel ORA_DISK_2: starting datafile backup set restore

channel ORA_DISK_2: specifying datafile(s) to restore from backup set

channel ORA_DISK_2: restoring datafile 00010 to /u02/oradata/CDB1/pdb1/sysaux01.dbf

channel ORA_DISK_2: restoring datafile 00011 to /u02/oradata/CDB1/pdb1/undotbs01.dbf

channel ORA_DISK_2: reading from backup piece /home/oracle/backup/0k2629oc_20_1_1

channel ORA_DISK_2: piece handle=/home/oracle/backup/0k2629oc_20_1_1 tag=TAG20230910T233410

channel ORA_DISK_2: restored backup piece 1

channel ORA_DISK_2: restore complete, elapsed time: 00:00:15

channel ORA_DISK_2: starting datafile backup set restore

channel ORA_DISK_2: specifying datafile(s) to restore from backup set

channel ORA_DISK_2: restoring datafile 00001 to /u02/oradata/CDB1/system01.dbf

channel ORA_DISK_2: restoring datafile 00007 to /u02/oradata/CDB1/users01.dbf

channel ORA_DISK_2: reading from backup piece /home/oracle/backup/0j2629nj_19_1_1

channel ORA_DISK_1: piece handle=/home/oracle/backup/0i2629nj_18_1_1 tag=TAG20230910T233410

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:00:30

channel ORA_DISK_1: starting datafile backup set restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set

channel ORA_DISK_1: restoring datafile 00009 to /u02/oradata/CDB1/pdb1/system01.dbf

channel ORA_DISK_1: restoring datafile 00012 to /u02/oradata/CDB1/pdb1/users01.dbf

channel ORA_DISK_1: reading from backup piece /home/oracle/backup/0n2629or_23_1_1

channel ORA_DISK_1: piece handle=/home/oracle/backup/0n2629or_23_1_1 tag=TAG20230910T233410

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:00:25

channel ORA_DISK_2: piece handle=/home/oracle/backup/0j2629nj_19_1_1 tag=TAG20230910T233410

channel ORA_DISK_2: restored backup piece 1

channel ORA_DISK_2: restore complete, elapsed time: 00:00:40

Finished restore at 11-SEP-23

 

Starting recover at 11-SEP-23

using channel ORA_DISK_1

using channel ORA_DISK_2

 

starting media recovery

 

archived log for thread 1 with sequence 145 is already on disk as file /u02/oradata/CDB1/redo01.log

archived log for thread 1 with sequence 146 is already on disk as file /u02/oradata/CDB1/redo02.log

archived log for thread 1 with sequence 147 is already on disk as file /u02/oradata/CDB1/redo03.log

archived log file name=/u02/oradata/CDB1/redo01.log thread=1 sequence=145

archived log file name=/u02/oradata/CDB1/redo02.log thread=1 sequence=146

archived log file name=/u02/oradata/CDB1/redo03.log thread=1 sequence=147

media recovery complete, elapsed time: 00:00:01

Finished recover at 1

 

Otvoriti bazu resetlogs

 

RMAN> sql 'alter database open resetlogs';

 

SQL> archive log list;

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            /u01/app/oracle/product/19.0.0/dbhome_1/dbs/arch1

Oldest online log sequence     1

Next log sequence to archive   1

Current log sequence           1

 

SQL> alter system switch logfile;

--pojavili se novi logovi

ls -l

-rw-r-----. 1 oracle oinstall 31494144 Sep 11 02:07 1_1_1147226747.dbf

-rw-r-----. 1 oracle oinstall   131584 Sep 11 02:05 1_145_1145029602.dbf

-rw-r-----. 1 oracle oinstall   162304 Sep 11 02:05 1_146_1145029602.dbf

-rw-r-----. 1 oracle oinstall  8933376 Sep 11 02:05 1_147_1145029602.dbf

 

Napraviti novi backup

 

Brisem stare logove, backup

pwd

/u01/app/oracle/product/19.0.0/dbhome_1/dbs/arch1

[oracle@oralinux7 arch1]$ rm 1_14*

 

Pustam novi backup

/home/oracle/scripts/rman/RmanScript.sh