반응형
현 상태 확인
[oracle@ol7 ~]$ id
uid=54321(oracle) gid=54322(dba) groups=54322(dba) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[oracle@ol7 ~]$
[oracle@ol7 ~]$ env | grep SID
ORACLE_SID=CDBTST
[oracle@ol7 ~]$
[oracle@ol7 ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 19.0.0.0.0 - Production on Thu Oct 6 14:49:50 2022
Version 19.16.0.0.0
Copyright (c) 1982, 2022, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.16.0.0.0
SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDBTST READ WRITE NO
SQL>
SQL> set linesize 150
SQL> col name for a10
SQL> col FILE_NAME for a20
col file_name for a70
SQL> SELECT VP.NAME, CDF.TABLESPACE_NAME, CDF.FILE_NAME
2 FROM CDB_DATA_FILES CDF, V$PDBS VP
3 WHERE CDF.CON_ID = VP.CON_ID;
NAME TABLESPACE_NAME FILE_NAME
---------- ------------------------------ ----------------------------------------------------------------------
PDBTST SYSTEM /orapdbtst/system/sytem01.dbf
PDBTST SYSAUX /orapdbtst/system/sysaux01.dbf
PDBTST UNDOTBS1 /orapdbtst/system/unotodb01.dbf
PDBTST USERS /orapdbtst/system/user01.dbf
PDBTST TS_DATA /orapdbtst/data/ts_data_01.dbf
PDBTST TS_IDX /u01/app/oracle/product/19.0.0.0/dbs/ /orapdbtst/idx/ts_indx_01.dbf --> 이 것을 변경 하려 함
6 rows selected.
SQL>
SQL> !ls -a /u01/app/oracle/product/19.0.0.0/dbs/
. .. hc_CDBTST.dat hc_TST.dat init.ora lkCDBTST lkTST orapwCDBTST orapwTST spfileCDBTST.ora spfileTST.ora
SQL> !ls -a /u01/app/oracle/product/19.0.0.0/dbs/ /orapdbtst/idx/
/orapdbtst/idx/:
. ..
/u01/app/oracle/product/19.0.0.0/dbs/:
. .. hc_CDBTST.dat hc_TST.dat init.ora lkCDBTST lkTST orapwCDBTST orapwTST spfileCDBTST.ora spfileTST.ora
SQL> !ls -a '/u01/app/oracle/product/19.0.0.0/dbs/ /orapdbtst/idx/'
. .. ts_indx_01.dbf
SQL>
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.16.0.0.0
[oracle@ol7 ~]$
DBF File Move
[oracle@ol7 ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 19.0.0.0.0 - Production on Thu Oct 6 14:55:47 2022
Version 19.16.0.0.0
Copyright (c) 1982, 2022, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.16.0.0.0
SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT
SQL>
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDBTST READ WRITE NO
SQL>
SQL> ALTER SESSION SET CONTAINER=PDBTST;
Session altered.
SQL> show con_name
CON_NAME
------------------------------
PDBTST
SQL>
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
3 PDBTST READ WRITE NO
SQL> select file_name from dba_data_files;
FILE_NAME
--------------------------------------------------------------------------------
/orapdbtst/system/sytem01.dbf
/orapdbtst/system/sysaux01.dbf
/orapdbtst/system/unotodb01.dbf
/orapdbtst/system/user01.dbf
/orapdbtst/data/ts_data_01.dbf
/u01/app/oracle/product/19.0.0.0/dbs/ /orapdbtst/idx/ts_indx_01.dbf
6 rows selected.
SQL> alter database move datafile '/u01/app/oracle/product/19.0.0.0/dbs/ /orapdbtst/idx/ts_indx_01.dbf' to '/orapdbtst/idx/ts_indx_01.dbf';
Database altered.
SQL> !ls -al '/u01/app/oracle/product/19.0.0.0/dbs/ /orapdbtst/idx/ts_indx_01.dbf'
ls: cannot access /u01/app/oracle/product/19.0.0.0/dbs/ /orapdbtst/idx/ts_indx_01.dbf: No such file or directory
SQL> !ls -al /orapdbtst/idx/ts_indx_01.dbf
-rw-r-----. 1 oracle dba 1048584192 Oct 6 15:02 /orapdbtst/idx/ts_indx_01.dbf
SQL>
SQL> select file_name from dba_data_files;
FILE_NAME
--------------------------------------------------------------------------------
/orapdbtst/system/sytem01.dbf
/orapdbtst/system/sysaux01.dbf
/orapdbtst/system/unotodb01.dbf
/orapdbtst/system/user01.dbf
/orapdbtst/data/ts_data_01.dbf
/orapdbtst/idx/ts_indx_01.dbf
6 rows selected.
SQL>
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.16.0.0.0
[oracle@ol7 ~]$
반응형