반응형
■ [2025-06-06] Oracle Restart Single 서버에서 filesystem에 있는 DB를 ASM영역으로 옮기기 (19c)

 

[2025-06-06] Oracle Restart Single 서버에서 filesystem에 있는 DB를 ASM영역으로 옮기기 (19c)

 

[실습 환경]
OS : Oracle Linux Server 7.9 (Linux rdb01d 5.4.17-2102.201.3.el7uek.x86_64)
DB : Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production (Version 19.26.0.0.0)
SINGLE : tdb01t(192.168.0.51) : ORCL2

 

0. filesystem으로 구성 된 ORCL2 DB의 file 정보 확인

[2025-06-08:12:58:11][tdb01t]<ORCL2@SYS> col name for a50
[2025-06-08:12:58:11][tdb01t]<
ORCL2@SYS> select name from v$datafile;

NAME
--------------------------------------------------
/u01/app/oracle/oradata/ORCL2/system01.dbf
/u01/app/oracle/oradata/ORCL2/sysaux01.dbf
/u01/app/oracle/oradata/ORCL2/undotbs01.dbf
/u01/app/oracle/oradata/ORCL2/users01.dbf

4 rows selected.

Elapsed: 00:00:00.00

 

[2025-06-08:12:58:11][tdb01t]<ORCL2@SYS> col name for a100
[2025-06-08:12:58:11][tdb01t]<
ORCL2@SYS> select name from v$controlfile;

NAME
----------------------------------------------------------------------------------------------------
/u01/app/oracle/oradata/ORCL2/ORCL2_1/ORCL2/controlfile/o1_mf_n49zbtx7_.ctl
/u01/app/oracle/oradata/ORCL2/ORCL2_2/ORCL2/controlfile/o1_mf_n49zbv0r_.ctl

2 rows selected.

 

[2025-06-08:12:58:11][tdb01t]<ORCL2@SYS> col member for a100
[2025-06-08:12:58:11][tdb01t]<
ORCL2@SYS> select group#, member from v$logfile;

    GROUP# MEMBER
---------- ----------------------------------------------------------------------------------------------------
         3 /u01/app/oracle/oradata/ORCL2/ORCL2_1/ORCL2/onlinelog/o1_mf_3_n49zbvmc_.log
         3 /u01/app/oracle/oradata/ORCL2/ORCL2_2/ORCL2/onlinelog/o1_mf_3_n49zbvqt_.log
         2 /u01/app/oracle/oradata/ORCL2/ORCL2_1/ORCL2/onlinelog/o1_mf_2_n49zbvll_.log
         2 /u01/app/oracle/oradata/ORCL2/ORCL2_2/ORCL2/onlinelog/o1_mf_2_n49zbvo4_.log
         1 /u01/app/oracle/oradata/ORCL2/ORCL2_1/ORCL2/onlinelog/o1_mf_1_n49zbvkj_.log
         1 /u01/app/oracle/oradata/ORCL2/ORCL2_2/ORCL2/onlinelog/o1_mf_1_n49zbvo5_.log

6 rows selected.

Elapsed: 00:00:00.00

 

[2025-06-08:12:58:11][tdb01t]<ORCL2@SYS> select name from v$tempfile;

NAME
----------------------------------------------------------------------------------------------------
/u01/app/oracle/oradata/ORCL2/temp01.dbf

1 row selected.

Elapsed: 00:00:00.00

 

[2025-06-08:12:58:11][tdb01t]<ORCL2@SYS> show parameter spfile;

NAME                                 TYPE                              VALUE
------------------------------------ --------------------------------- ------------------------------
spfile                               string                            /u01/app/oracle/product/19c/db
                                                                       _1/dbs/spfileORCL2.ora


1. pfile 생성

 

[2025-06-08:12:58:11][tdb01t]<ORCL2@SYS> create pfile='/u01/app/oracle/product/19c/db_1/dbs/initORCL2.ora' from spfile;

File created.

Elapsed: 00:00:00.00


[2025-06-08:12:58:11][tdb01t]<ORCL2@SYS> host ls -l /u01/app/oracle/product/19c/db_1/dbs/initORCL2.ora
-rw-r--r--. 1 oracle asmadmin 1333 Jun  8 13:17 /u01/app/oracle/product/19c/db_1/dbs/initORCL2.ora


2. control file restore

 

[2025-06-08:12:58:11][tdb01t]<ORCL2@SYS> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

 

--FILE 시스템에 있는 SPFILE로 NOMOUNT하는 것임!!!

[2025-06-08:12:58:11][tdb01t]<ORCL2@SYS> startup nomount
ORACLE instance started.

Total System Global Area 1.0100E+10 bytes
Fixed Size                  8950000 bytes
Variable Size            1509949440 bytes
Database Buffers         8556380160 bytes
Redo Buffers               24600576 bytes

 

--파일 시스템에 존재하는 컨트롤 파일을 ASM영역에 RESTORE 시킴 (복사되는 것임)
RMAN> restore controlfile to '+DATA1' from '/u01/app/oracle/oradata/ORCL2/ORCL2_1/ORCL2/controlfile/o1_mf_n49zbtx7_.ctl';
restore controlfile to '+DATA1' from '/u01/app/oracle/oradata/ORCL2/ORCL2_1/ORCL2/controlfile/o1_mf_n49zbtx7_.ctl';
Starting restore at 2025-06-08 13:22:38
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=12 device type=DISK

channel ORA_DISK_1: copied control file copy
Finished restore at 2025-06-08 13:22:46

 

--grid user로 접속해서 생성된 컨트롤 파일 확인
[+ASM:grid@tdb01t][/u01/app/19c/grid/network/admin]$ asmcmd ls -sl +DATA1/ORCL2/CONTROLFILE
Type         Redund  Striped  Time             Sys  Block_Size  Blocks     Bytes     Space  Name
CONTROLFILE  UNPROT  FINE     JUN 08 13:00:00  Y         16384     647  10600448  33554432  current.353.1203254563


--pfile 내 control_files 정보를 변경함
alias cdod='cd $ORACLE_HOME/dbs'
[ORCL2:oracle@tdb01t][/home/oracle]$ cdod
[ORCL2:oracle@tdb01t][/u01/app/oracle/product/19c/db_1/dbs]$ vi initORCL2.ora
[ORCL2:oracle@tdb01t][/u01/app/oracle/product/19c/db_1/dbs]$ cat initORCL2.ora | grep -i control_files
#*.control_files='/u01/app/oracle/oradata/ORCL2/ORCL2_1/ORCL2/controlfile/o1_mf_n49zbtx7_.ctl','/u01/app/oracle/oradata/ORCL2/ORCL2_2/ORCL2/controlfile/o1_mf_n49zbv0r_.ctl'

*.control_files='+DATA1/ORCL2/CONTROLFILE/current.353.1203254563'

 

--현재는 spfile로 db를 nomount한 상태이므로 파라미터 내용 변경 (SPFILE의 내용을 변경해주는 것임!)

[2025-06-08:13:36:20][tdb01t]<ORCL2@SYS> alter system set control_files='+DATA1/ORCL2/CONTROLFILE/current.353.1203254563' scope=spfile;

System altered.

Elapsed: 00:00:00.01

[2025-06-08:13:36:20][tdb01t]<ORCL2@SYS> shutdown immediate;

ORA-01507: database not mounted


ORACLE instance shut down.

 

[2025-06-08:13:36:20][tdb01t]<ORCL2@SYS> startup mount;
ORACLE instance started.

Total System Global Area 1.0100E+10 bytes
Fixed Size                  8950000 bytes
Variable Size            1509949440 bytes
Database Buffers         8556380160 bytes
Redo Buffers               24600576 bytes
Database mounted.

 

[2025-06-08:13:36:20][tdb01t]<ORCL2@SYS> show parameter spfile;

NAME                                 TYPE                              VALUE
------------------------------------ --------------------------------- ------------------------------
spfile                               string                            /u01/app/oracle/product/19c/db
                                                                       _1/dbs/spfileORCL2.ora

 

[2025-06-08:13:36:20][tdb01t]<ORCL2@SYS> show parameter control_files;

NAME                                 TYPE                              VALUE
------------------------------------ --------------------------------- ------------------------------
control_files                        string                            +DATA1/ORCL2/CONTROLFILE/curre
                                                                       nt.353.1203254563
--> 컨트롤 파일이 asm 영역으로 들어간 것을 확인

 

3. datafile을 ASM영역으로 옮기기

 

[ORCL2:oracle@tdb01t][/home/oracle]$ alias rt
alias rt='rman target /'
[ORCL2:oracle@tdb01t][/home/oracle]$ rt

Recovery Manager: Release 19.0.0.0.0 - Production on Sun Jun 8 13:41:46 2025
Version 19.26.0.0.0

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

connected to target database: ORCL2 (DBID=1184081642, not open)

RMAN> configure device type disk parallelism 4;
configure device type disk parallelism 4;
using target database control file instead of recovery catalog
new RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK PARALLELISM 4 BACKUP TYPE TO BACKUPSET;
new RMAN configuration parameters are successfully stored

 

--파일시스템의 데이터파일을 ASM의 +DATA1 디스크그룹으로 COPY함
RMAN> backup as copy database format '+DATA1';
backup as copy database format '+DATA1';
Starting backup at 2025-06-08 13:42:28
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=142 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=266 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=393 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=14 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/u01/app/oracle/oradata/ORCL2/system01.dbf
channel ORA_DISK_2: starting datafile copy
input datafile file number=00003 name=/u01/app/oracle/oradata/ORCL2/sysaux01.dbf
channel ORA_DISK_3: starting datafile copy
input datafile file number=00004 name=/u01/app/oracle/oradata/ORCL2/undotbs01.dbf
channel ORA_DISK_4: starting datafile copy
input datafile file number=00007 name=/u01/app/oracle/oradata/ORCL2/users01.dbf
output file name=+DATA1/ORCL2/DATAFILE/users.367.1203255751 tag=TAG20250608T134229 RECID=1 STAMP=1203255753
channel ORA_DISK_4: datafile copy complete, elapsed time: 00:00:03
output file name=+DATA1/ORCL2/DATAFILE/system.354.1203255749 tag=TAG20250608T134229 RECID=4 STAMP=1203255757
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:09
output file name=+DATA1/ORCL2/DATAFILE/sysaux.355.1203255749 tag=TAG20250608T134229 RECID=2 STAMP=1203255757
channel ORA_DISK_2: datafile copy complete, elapsed time: 00:00:09
output file name=+DATA1/ORCL2/DATAFILE/undotbs1.356.1203255751 tag=TAG20250608T134229 RECID=3 STAMP=1203255757
channel ORA_DISK_3: datafile copy complete, elapsed time: 00:00:08
Finished backup at 2025-06-08 13:42:38

Starting Control File and SPFILE Autobackup at 2025-06-08 13:42:38
piece handle=/u01/app/oracle/product/19c/db_1/dbs/c-1184081642-20250608-00 comment=NONE
Finished Control File and SPFILE Autobackup at 2025-06-08 13:42:39

 

--컨트롤 파일의 데이터파일 경로 정보도 바꿔줌 (RMAN도 ASM 경로를 인식하게됨)
RMAN> switch database to copy;
switch database to copy;
datafile 1 switched to datafile copy "+DATA1/ORCL2/DATAFILE/system.354.1203255749"
datafile 3 switched to datafile copy "+DATA1/ORCL2/DATAFILE/sysaux.355.1203255749"
datafile 4 switched to datafile copy "+DATA1/ORCL2/DATAFILE/undotbs1.356.1203255751"
datafile 7 switched to datafile copy "+DATA1/ORCL2/DATAFILE/users.367.1203255751"

 

[+ASM:grid@tdb01t][/home/grid]$ asmcmd ls -sl +DATA1/ORCL2/DATAFILE
Type      Redund  Striped  Time             Sys  Block_Size  Blocks       Bytes       Space  Name
DATAFILE  UNPROT  COARSE   JUN 08 13:00:00  Y          8192  119041   975183872   981467136  SYSAUX.355.1203255749
DATAFILE  UNPROT  COARSE   JUN 08 13:00:00  Y          8192  143361  1174413312  1182793728  SYSTEM.354.1203255749
DATAFILE  UNPROT  COARSE   JUN 08 13:00:00  Y          8192  100481   823140352   830472192  UNDOTBS1.356.1203255751
DATAFILE  UNPROT  COARSE   JUN 08 13:00:00  Y          8192     641     5251072     8388608  USERS.367.1203255751


RMAN> ALTER DATABASE OPEN;
ALTER DATABASE OPEN;
Statement processed

 

[2025-06-08:13:56:19][tdb01t]<ORCL2@SYS> col file_name for a50
[2025-06-08:13:56:19][tdb01t]<
ORCL2@SYS> select file_name from dba_data_files;

FILE_NAME
--------------------------------------------------
+DATA1/ORCL2/DATAFILE/users.367.1203255751
+DATA1/ORCL2/DATAFILE/undotbs1.356.1203255751
+DATA1/ORCL2/DATAFILE/system.354.1203255749
+DATA1/ORCL2/DATAFILE/sysaux.355.1203255749


4. redo log 파일을 ASM영역으로 옮기기

 

col status for a20
select GROUP#, MEMBERS, STATUS, bytes/1024/1024 as mb from v$log;
    GROUP#    MEMBERS STATUS                       MB
---------- ---------- -------------------- ----------
         1          2 INACTIVE                    200
         2          2 INACTIVE                    200
         3          2 CURRENT                     200

--> GROUP 1번과 2번이 INACTIVE 상태인것을 확인

 


col status for a20
col MEMBER for a80
select GROUP#, MEMBER, STATUS from v$logfile;
    GROUP# MEMBER                                                                           STATUS
---------- -------------------------------------------------------------------------------- --------------------
         3 /u01/app/oracle/oradata/ORCL2/ORCL2_1/ORCL2/onlinelog/o1_mf_3_n49zbvmc_.log      (NULL)
         3 /u01/app/oracle/oradata/ORCL2/ORCL2_2/ORCL2/onlinelog/o1_mf_3_n49zbvqt_.log      (NULL)
         2 /u01/app/oracle/oradata/ORCL2/ORCL2_1/ORCL2/onlinelog/o1_mf_2_n49zbvll_.log      (NULL)
         2 /u01/app/oracle/oradata/ORCL2/ORCL2_2/ORCL2/onlinelog/o1_mf_2_n49zbvo4_.log      (NULL)
         1 /u01/app/oracle/oradata/ORCL2/ORCL2_1/ORCL2/onlinelog/o1_mf_1_n49zbvkj_.log      (NULL)
         1 /u01/app/oracle/oradata/ORCL2/ORCL2_2/ORCL2/onlinelog/o1_mf_1_n49zbvo5_.log      (NULL)

 

[2025-06-08:13:56:19][tdb01t]<ORCL2@SYS> alter database drop logfile group 1;
[2025-06-08:13:56:19][tdb01t]<ORCL2@SYS> alter database add logfile group 1 ('+DATA1', '+FRA1') size 200M;

Database altered.

Elapsed: 00:00:02.05


col status for a20
select GROUP#, MEMBERS, STATUS, bytes/1024/1024 as mb from v$log;

    GROUP#    MEMBERS STATUS                       MB
---------- ---------- -------------------- ----------
         1          2 UNUSED                      200
         2          2 INACTIVE                    200
         3          2 CURRENT                     200

--> GROUP 2번이 INACITVE인 것을 확인

 

[2025-06-08:13:56:19][tdb01t]<ORCL2@SYS> alter database drop logfile group 2;

Database altered.

Elapsed: 00:00:00.04
[2025-06-08:13:56:19][tdb01t]<ORCL2@SYS> alter database add logfile group 2 ('+DATA1', '+FRA1') size 200M;

Database altered.

Elapsed: 00:00:01.96

 

[2025-06-08:13:56:19][tdb01t]<ORCL2@SYS> alter system switch logfile;

System altered.

Elapsed: 00:00:00.08

 

col status for a20
[2025-06-08:13:56:19][tdb01t]<
ORCL2@SYS> select GROUP#, MEMBERS, STATUS, bytes/1024/1024 as mb from v$log;

    GROUP#    MEMBERS STATUS                       MB
---------- ---------- -------------------- ----------
         1          2 CURRENT                     200
         2          2 UNUSED                      200
         3          2 ACTIVE                      200

3 rows selected.

Elapsed: 00:00:00.01

 

[2025-06-08:13:56:19][tdb01t]<ORCL2@SYS> alter system checkpoint;

System altered.

Elapsed: 00:00:00.08


[2025-06-08:13:56:19][tdb01t]<ORCL2@SYS> select GROUP#, MEMBERS, STATUS, bytes/1024/1024 as mb from v$log;

    GROUP#    MEMBERS STATUS                       MB
---------- ---------- -------------------- ----------
         1          2 CURRENT                     200
         2          2 UNUSED                      200
         3          2 INACTIVE                    200

--> GROUP 3번이 INACTIVE인 것을 알 수 있음

3 rows selected.

 

[2025-06-08:13:56:19][tdb01t]<ORCL2@SYS> alter database drop logfile group 3;

Database altered.

Elapsed: 00:00:00.08

 

[2025-06-08:13:56:19][tdb01t]<ORCL2@SYS> alter database add logfile group 3 ('+DATA1', '+FRA1') size 200M;

Database altered.

Elapsed: 00:00:02.50

 

col status for a20
col MEMBER for a80
select GROUP#, MEMBER, STATUS from v$logfile;

    GROUP# MEMBER                                                                           STATUS
---------- -------------------------------------------------------------------------------- --------------------
         3 +DATA1/ORCL2/ONLINELOG/group_3.371.1203257063                                    (NULL)
         3 +FRA1/ORCL2/ONLINELOG/group_3.288.1203257063                                     (NULL)
         2 +DATA1/ORCL2/ONLINELOG/group_2.366.1203256957                                    (NULL)
         2 +FRA1/ORCL2/ONLINELOG/group_2.294.1203256957                                     (NULL)
         1 +DATA1/ORCL2/ONLINELOG/group_1.368.1203256911                                    (NULL)
         1 +FRA1/ORCL2/ONLINELOG/group_1.295.1203256913                                     (NULL)

 

5. 파라미터 파일 수정

 

[2025-06-08:13:56:19][tdb01t]<ORCL2@SYS> create pfile='/u01/app/oracle/product/19c/db_1/dbs/initORCL2.ora' from spfile;

File created.

Elapsed: 00:00:00.00

 

[ORCL2:oracle@tdb01t][/u01/app/oracle/product/19c/db_1/dbs]$ vi initORCL2.ora
[ORCL2:oracle@tdb01t][/u01/app/oracle/product/19c/db_1/dbs]$ cat initORCL2.ora
ORCL2.__data_transfer_cache_size=0
ORCL2.__db_cache_size=8422162432
ORCL2.__inmemory_ext_roarea=0
ORCL2.__inmemory_ext_rwarea=0
ORCL2.__java_pool_size=0
ORCL2.__large_pool_size=33554432
ORCL2.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
ORCL2.__pga_aggregate_target=3388997632
ORCL2.__sga_target=10099884032
ORCL2.__shared_io_pool_size=134217728
ORCL2.__shared_pool_size=1476395008
ORCL2.__streams_pool_size=0
ORCL2.__unified_pga_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/ORCL2/adump'
*.audit_trail='db'
*.compatible='19.0.0'
*.control_files='+DATA1/ORCL2/CONTROLFILE/current.353.1203254563'
*.db_block_size=8192
#*.db_create_online_log_dest_1='/u01/app/oracle/oradata/ORCL2/ORCL2_1' --> 주석 처리
#*.db_create_online_log_dest_2='/u01/app/oracle/oradata/ORCL2/ORCL2_2' --> 주석 처리
*.db_create_file_dest='+DATA1' --> 추가
*.db_name='ORCL2'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=ORCL2XDB)'
*.local_listener='LISTENER_ORCL2'
*.log_archive_dest_1='LOCATION=+FRA1/ORCL2/ARCH' --> 변경 (지정해줌)
*.log_archive_format='%t_%s_%r.ARC'
*.nls_language='AMERICAN'
*.nls_territory='KOREA'
*.open_cursors=300
*.pga_aggregate_target=3211m
*.processes=320
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=9630m
*.undo_tablespace='UNDOTBS1'

 

[+ASM:grid@tdb01t][/home/grid]$ asmcmd mkdir +FRA1/ORCL2/ARCH

[ORCL2:oracle@tdb01t][/u01/app/oracle/product/19c/db_1/dbs]$ ss

SQL*Plus: Release 19.0.0.0.0 - Production on Sun Jun 8 14:12:46 2025
Version 19.26.0.0.0

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

Connected to an idle instance.


[2025-06-08 14:12:47][]<ORCL2@SYS> startup pfile='/u01/app/oracle/product/19c/db_1/dbs/initORCL2.ora';
ORACLE instance started.

Total System Global Area 1.0100E+10 bytes
Fixed Size                  8950000 bytes
Variable Size            1509949440 bytes
Database Buffers         8556380160 bytes
Redo Buffers               24600576 bytes
Database mounted.
Database opened.

 

[2025-06-08 14:12:47][]<ORCL2@SYS> create spfile='+DATA1' from pfile='/u01/app/oracle/product/19c/db_1/dbs/initORCL2.ora';

File created.

Elapsed: 00:00:00.47

[2025-06-08 14:12:47][]<ORCL2@SYS>

[+ASM:grid@tdb01t][/home/grid]$ asmcmd ls -sl +DATA1/ORCL2/PARAMETERFILE/
Type           Redund  Striped  Time             Sys  Block_Size  Blocks  Bytes    Space  Name
PARAMETERFILE  UNPROT  COARSE   JUN 08 14:00:00  Y           512       7   3584  4194304  spfile.365.1203257657

 

[ORCL2:oracle@tdb01t][/u01/app/oracle/product/19c/db_1/dbs]$ srvctl config database -db orcl2
Database unique name: ORCL2
Database name: ORCL2
Oracle home: /u01/app/oracle/product/19c/db_1
Oracle user: oracle
Spfile: +DATA1/ORCL2/PARAMETERFILE/spfile.365.1203257657
Password file:
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Disk Groups: DATA1
Services:
OSDBA group:
OSOPER group:
Database instance: ORCL2

 

[ORCL2:oracle@tdb01t][/u01/app/oracle/product/19c/db_1/dbs]$ srvctl modify database -db orcl2 -diskgroup "DATA1,FRA1"

 

 

--PW파일도 ASM영역으로 COPY시킴

[ORCL2:oracle@tdb01t][/u01/app/oracle/product/19c/db_1/dbs]$ cp /u01/app/oracle/product/19c/db_1/dbs/orapwORCL2 /tmp
[ORCL2:oracle@tdb01t][/u01/app/oracle/product/19c/db_1/dbs]$ chmod 777 /tmp/orapwORCL2

ASMCMD [+] > pwcopy --dbuniquename ORCL2 -f /tmp/orapwORCL2 +DATA1/ORCL2/PASSWORD/
copying /tmp/orapwORCL2 -> +DATA1/ORCL2/PASSWORD/orapwORCL2

 

[+ASM:grid@tdb01t][/home/grid]$ asmcmd ls -ls +DATA1/ORCL2/PASSWORD
Type      Redund  Striped  Time             Sys  Block_Size  Blocks  Bytes  Space  Name
PASSWORD  UNPROT  COARSE   JUN 08 14:00:00  N           512       4   2048      0  orapworcl2 => +DATA1/ORCL2/PASSWORD/pwdorcl2.374.1203258397
PASSWORD  UNPROT  COARSE   JUN 08 14:00:00  Y           512       4   2048      0  pwdorcl2.374.1203258397

 

[+ASM:grid@tdb01t][/home/grid]$ srvctl modify database -db ORCL2 -pwfile +DATA1/ORCL2/PASSWORD/orapworcl2

[+ASM:grid@tdb01t][/home/grid]$ srvctl config database -db ORCL2
Database unique name: ORCL2
Database name: ORCL2
Oracle home: /u01/app/oracle/product/19c/db_1
Oracle user: oracle
Spfile: +DATA1/ORCL2/PARAMETERFILE/spfile.365.1203257657
Password file: +DATA1/ORCL2/PASSWORD/orapworcl2
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Disk Groups: DATA1,FRA1
Services:
OSDBA group:
OSOPER group:
Database instance: ORCL2


[+ASM:grid@tdb01t][/home/grid]$ srvctl stop database -db orcl2
[+ASM:grid@tdb01t][/home/grid]$ srvctl start database -db orcl2


6. 템프 테이블 스페이스 파일을 asm영역으로 옮기기

 

[+ASM:grid@tdb01t][/home/grid]$ asmcmd mkdir +DATA1/ORCL2/TEMPFILE

[2025-06-08:14:39:07][tdb01t]<ORCL2@SYS> select name from v$tempfile;

NAME
--------------------------------------------------
/u01/app/oracle/oradata/ORCL2/temp01.dbf

 

[2025-06-08:14:40:09][tdb01t]<ORCL2@SYS> shutdown immediate;
[2025-06-08:14:40:09][tdb01t]<
ORCL2@SYS> quit

 

[ORCL2:oracle@tdb01t][/u01/app/oracle/product/19c/db_1/dbs]$ cp /u01/app/oracle/oradata/ORCL2/temp01.dbf /tmp/
[ORCL2:oracle@tdb01t][/u01/app/oracle/product/19c/db_1/dbs]$ chmod 775 /tmp/temp01.dbf


[+ASM:grid@tdb01t][/home/grid]$ asmcmd cp /tmp/temp01.dbf +DATA1/ORCL2/TEMPFILE/
copying /tmp/temp01.dbf -> +DATA1/ORCL2/TEMPFILE/temp01.dbf

[2025-06-08 14:43:04][]<ORCL2@SYS> startup mount

[2025-06-08 14:43:04][]<ORCL2@SYS> ALTER DATABASE RENAME FILE '/u01/app/oracle/oradata/ORCL2/temp01.dbf' to '+DATA1/ORCL2/TEMPFILE/temp01.dbf';

Database altered.

Elapsed: 00:00:00.04

[2025-06-08 14:43:04][]<ORCL2@SYS> alter database open;


--기존 filesystem에서 생성된 아카이브 로그를 asm영역으로 이동

[ORCL2:oracle@tdb01t][/u01/app/oracle/oradata/ORCL2/ARCH]$ ll
total 197108
-rw-r-----. 1 oracle asmadmin 196910592 Jun  8 13:53 1_11_1203249771.ARC
-rw-r-----. 1 oracle asmadmin   4926976 Jun  8 14:03 1_12_1203249771.ARC
[ORCL2:oracle@tdb01t][/u01/app/oracle/oradata/ORCL2/ARCH]$ cp 1_11_1203249771.ARC /tmp
[ORCL2:oracle@tdb01t][/u01/app/oracle/oradata/ORCL2/ARCH]$ cp 1_12_1203249771.ARC /tmp
[ORCL2:oracle@tdb01t][/u01/app/oracle/oradata/ORCL2/ARCH]$ chmod 775 /tmp/1_11_1203249771.ARC
[ORCL2:oracle@tdb01t][/u01/app/oracle/oradata/ORCL2/ARCH]$ chmod 775 /tmp/1_12_1203249771.ARC


[+ASM:grid@tdb01t][/home/grid]$ asmcmd cp /tmp/1_11_1203249771.ARC +FRA1/ORCL2/ARCH/1_11_1203249771.ARC
copying /tmp/1_11_1203249771.ARC -> +FRA1/ORCL2/ARCH/1_11_1203249771.ARC
[+ASM:grid@tdb01t][/home/grid]$ asmcmd cp /tmp/1_12_1203249771.ARC +FRA1/ORCL2/ARCH/1_12_1203249771.ARC
copying /tmp/1_12_1203249771.ARC -> +FRA1/ORCL2/ARCH/1_12_1203249771.ARC

 


7. ASM으로 구성 된 ORCL2 DB의 file 정보 확인

[2025-06-08 14:43:04][]<ORCL2@SYS> select name from v$datafile;

NAME
--------------------------------------------------
+DATA1/ORCL2/DATAFILE/system.354.1203255749
+DATA1/ORCL2/DATAFILE/sysaux.355.1203255749
+DATA1/ORCL2/DATAFILE/undotbs1.356.1203255751
+DATA1/ORCL2/DATAFILE/users.367.1203255751

4 rows selected.

Elapsed: 00:00:00.02

 

col name for a100
[2025-06-08 14:43:04][]<
ORCL2@SYS> select name from v$controlfile;

NAME
----------------------------------------------------------------------------------------------------
+DATA1/ORCL2/CONTROLFILE/current.353.1203254563

1 row selected.

Elapsed: 00:00:00.00

 

col member for a100
[2025-06-08 14:43:04][]<
ORCL2@SYS> select group#, member from v$logfile;

    GROUP# MEMBER
---------- ----------------------------------------------------------------------------------------------------
         3 +DATA1/ORCL2/ONLINELOG/group_3.371.1203257063
         3 +FRA1/ORCL2/ONLINELOG/group_3.288.1203257063
         2 +DATA1/ORCL2/ONLINELOG/group_2.366.1203256957
         2 +FRA1/ORCL2/ONLINELOG/group_2.294.1203256957
         1 +DATA1/ORCL2/ONLINELOG/group_1.368.1203256911
         1 +FRA1/ORCL2/ONLINELOG/group_1.295.1203256913

6 rows selected.

Elapsed: 00:00:00.01

 

[2025-06-08 14:43:04][]<ORCL2@SYS> select name from v$tempfile;

NAME
----------------------------------------------------------------------------------------------------
+DATA1/ORCL2/TEMPFILE/temp01.dbf

1 row selected.

Elapsed: 00:00:00.01

 

[2025-06-08 14:43:04][]<ORCL2@SYS> show parameter spfile;

NAME                                 TYPE                              VALUE
------------------------------------ --------------------------------- ------------------------------
spfile                               string                            +DATA1/ORCL2/PARAMETERFILE/spf
                                                                       ile.365.1203257657

 

[ORCL2:oracle@tdb01t][/u01/app/oracle/oradata]$ rm -rf /u01/app/oracle/oradata/ORCL2

 

반응형

+ Recent posts