Home

Wednesday, March 21, 2012

Cara me-rename atau merubah datafile Tablespace System

Berikut ini step-step cara merename tablespace system (saya melakukan simulasi ini di  vmware ) :

Cek lokasi file dari tablespace system
----------------------------------------------------

SQL> select file_name from dba_data_files where tablespace_name='SYSTEM';
FILE_NAME
--------------------------------------------------------------------------------
/export/home/oracle/sysdata/system01.dbf

Shutdown Database (Cleanup Shutdown)
-----------------------------------------------------------
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>exit

-bash-3.00$ pwd
/export/home/oracle/tempfile
-bash-3.00$ cd ..
-bash-3.00$ ls
Desktop              archives             bebek.txt            local.login          oradata              sysdata
Documents            backup               flash_recovery_area  local.profile        product              tempfile
admin                backup02             local.cshrc          oraInventory         scripts

-bash-3.00$ cd sysdata
-bash-3.00$ ls
system01.dbf

-bash-3.00$ mv system01.dbf ../oradata/
-bash-3.00$ ls
-bash-3.00$

Startup Database dalam mode exsclusive
-------------------------------------------------------
-bash-3.00$ sqlplus "/as sysdba"
SQL*Plus: Release 10.2.0.2.0 - Production on Mon Jun 28 12:41:38 2010
Copyright (c) 1982, 2005, Oracle.  All Rights Reserved.
Connected to an idle instance.
SQL> startup exclusive mount;
ORACLE instance started.
Total System Global Area  658505728 bytes
Fixed Size                  1281936 bytes
Variable Size             176160880 bytes
Database Buffers          478150656 bytes
Redo Buffers                2912256 bytes
Database mounted.

Alter database file system
-------------------------------------------
SQL> alter database rename file '/export/home/oracle/sysdata/system01.dbf' to '/export/home/oracle/oradata/system01.dbf';
Database altered.

Shutdown Database
-------------------------------------
SQL> shutdown;
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
SQL>

Startup Normal Database
--------------------------------------
SQL> startup;
ORACLE instance started.
Total System Global Area  658505728 bytes
Fixed Size                  1281936 bytes
Variable Size             176160880 bytes
Database Buffers          478150656 bytes
Redo Buffers                2912256 bytes
Database mounted.
Database opened.

Cek datafile system untuk melihat perubahan datafile system
-------------------------------------------------------------------------------------
SQL> select file_name from dba_data_files where tablespace_name='SYSTEM';
FILE_NAME
--------------------------------------------------------------------------------
/export/home/oracle/oradata/system01.dbf
SQL>

Note : Lakukan di mesin test terlebih dahulu sebelum melakukan di production

No comments:

Post a Comment