Tobotobo / docker_oracle_18c_xe

0 stars 0 forks source link

オフラインバックアップの取得 #1

Open Tobotobo opened 4 weeks ago

Tobotobo commented 4 weeks ago

Oracle オフラインバックアップの取得 ※まだ確認中

■ OSのユーザー「oracle」でログインする ssh oracle@localhost -p2222

■ Recovery Manager(RMAN)を起動する rman target /

[oracle@77b1d252f35c ~]$ rman target /

Recovery Manager: Release 18.0.0.0.0 - Production on Tue Oct 29 15:22:03 2024
Version 18.4.0.0.0

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

connected to target database: XE (DBID=3064768960)

RMAN>

■ データベースを停止する SHUTDOWN IMMEDIATE;

RMAN> SHUTDOWN IMMEDIATE;

using target database control file instead of recovery catalog
database closed
database dismounted
Oracle instance shut down

■ データベースをマウントする STARTUP MOUNT;

RMAN> STARTUP MOUNT;

connected to target database (not started)
Oracle instance started
database mounted

Total System Global Area     935327720 bytes

Fixed Size                     8902632 bytes
Variable Size                352321536 bytes
Database Buffers             570425344 bytes
Redo Buffers                   3678208 bytes

■ バックアップを取得する BACKUP DATABASE INCLUDE CURRENT CONTROLFILE;

RMAN> BACKUP DATABASE INCLUDE CURRENT CONTROLFILE;

Starting backup at 29-OCT-24
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=379 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/opt/oracle/oradata/XE/system01.dbf
input datafile file number=00003 name=/opt/oracle/oradata/XE/sysaux01.dbf
input datafile file number=00004 name=/opt/oracle/oradata/XE/undotbs01.dbf
input datafile file number=00007 name=/opt/oracle/oradata/XE/users01.dbf
channel ORA_DISK_1: starting piece 1 at 29-OCT-24
channel ORA_DISK_1: finished piece 1 at 29-OCT-24
piece handle=/opt/oracle/product/18c/dbhomeXE/dbs/0138q3nf_1_1 tag=TAG20241029T153158 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00010 name=/opt/oracle/oradata/XE/XEPDB1/sysaux01.dbf
input datafile file number=00009 name=/opt/oracle/oradata/XE/XEPDB1/system01.dbf
input datafile file number=00011 name=/opt/oracle/oradata/XE/XEPDB1/undotbs01.dbf
input datafile file number=00012 name=/opt/oracle/oradata/XE/XEPDB1/users01.dbf
channel ORA_DISK_1: starting piece 1 at 29-OCT-24
channel ORA_DISK_1: finished piece 1 at 29-OCT-24
piece handle=/opt/oracle/product/18c/dbhomeXE/dbs/0238q3nu_1_1 tag=TAG20241029T153158 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00006 name=/opt/oracle/oradata/XE/pdbseed/sysaux01.dbf
input datafile file number=00005 name=/opt/oracle/oradata/XE/pdbseed/system01.dbf
input datafile file number=00008 name=/opt/oracle/oradata/XE/pdbseed/undotbs01.dbf
channel ORA_DISK_1: starting piece 1 at 29-OCT-24
channel ORA_DISK_1: finished piece 1 at 29-OCT-24
piece handle=/opt/oracle/product/18c/dbhomeXE/dbs/0338q3o5_1_1 tag=TAG20241029T153158 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 29-OCT-24
channel ORA_DISK_1: finished piece 1 at 29-OCT-24
piece handle=/opt/oracle/product/18c/dbhomeXE/dbs/0438q3o8_1_1 tag=TAG20241029T153158 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 29-OCT-24

Starting Control File and SPFILE Autobackup at 29-OCT-24
piece handle=/opt/oracle/product/18c/dbhomeXE/dbs/c-3064768960-20241029-00 comment=NONE
Finished Control File and SPFILE Autobackup at 29-OCT-24

■ 取得したバックアップを確認する LIST BACKUP SUMMARY;

RMAN> LIST BACKUP SUMMARY;

List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
1       B  F  A DISK        29-OCT-24       1       1       NO         TAG20241029T153158
2       B  F  A DISK        29-OCT-24       1       1       NO         TAG20241029T153158
3       B  F  A DISK        29-OCT-24       1       1       NO         TAG20241029T153158
4       B  F  A DISK        29-OCT-24       1       1       NO         TAG20241029T153158
5       B  F  A DISK        29-OCT-24       1       1       NO         TAG20241029T153226

■ データベースを起動する STARTUP;

RMAN> STARTUP;

database is already started
database opened

ALTER DATABASE OPEN;

RMAN> ALTER DATABASE OPEN;

Statement processed

■ Recovery Manager(RMAN)を終了する quit

RMAN> quit

Recovery Manager complete.
[oracle@77b1d252f35c ~]$

■ SQL*Plusを起動する sqlplus / as sysdba

[oracle@77b1d252f35c ~]$ sqlplus / as sysdba

SQL*Plus: Release 18.0.0.0.0 - Production on Tue Oct 29 16:11:43 2024
Version 18.4.0.0.0

Copyright (c) 1982, 2018, Oracle.  All rights reserved.

Connected to:
Oracle Database 18c Express Edition Release 18.0.0.0.0 - Production
Version 18.4.0.0.0

SQL>

■ データベース(CDBとPDB)が起動されているか確認する

SET LINESIZE 1000 SELECT NAME, OPEN_MODE FROM V$DATABASE; SELECT CON_ID, NAME, OPEN_MODE FROM V$PDBS;

SQL> SET LINESIZE 1000
SQL> SELECT NAME, OPEN_MODE FROM V$DATABASE;

NAME      OPEN_MODE
--------- --------------------
XE        READ WRITE

SQL> SELECT CON_ID, NAME, OPEN_MODE FROM V$PDBS;

    CON_ID NAME                                                                                                                             OPEN_MODE
---------- -------------------------------------------------------------------------------------------------------------------------------- ----------
         2 PDB$SEED                                                                                                                         READ ONLY
         3 XEPDB1                                                                                                                           READ WRITE

■ SQL*Plusを終了する exit

SQL> exit
Disconnected from Oracle Database 18c Express Edition Release 18.0.0.0.0 - Production
Version 18.4.0.0.0
[oracle@77b1d252f35c ~]$
Tobotobo commented 2 weeks ago

rman target / SHUTDOWN IMMEDIATE; STARTUP MOUNT; BACKUP DATABASE; BACKUP CURRENT CONTROLFILE;

LIST BACKUP SUMMARY;

ALTER DATABASE OPEN;