Oracle移动数据文件不停机和停机两种方式详解(oracle数据存放位置)快来看

随心笔谈11个月前发布 admin
105 0

–开启归档模式
SQL> archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination /archivelog
Oldest online log sequence 1
Current log sequence 2
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL>
SQL> startup mount
ORACLE instance started.
Total System Global Area 1603411968 bytes
Fixed Size 2253664 bytes
Variable Size 452988064 bytes
Database Buffers 1140850688 bytes
Redo Buffers 7319552 bytes
Database mounted.
SQL> alter database archivelog;
Database altered.
SQL> alter database open;
Database altered.
–offline数据文件
SQL> /
FILE# NAME STATUS
———- ———————————————————— ——-
1 /oradata/orcl11g/system01.dbf SYSTEM
2 /oradata/orcl11g/sysaux01.dbf ONLINE
3 /oradata/orcl11g/undotbs01.dbf ONLINE
4 /oradata/orcl11g/users01.dbf ONLINE
5 /oradata/orcl11g/example01.dbf ONLINE
6 /oradata/orcl11g/test01.dbf ONLINE
7 /oradata/ORCL11G/datafile/o1_mf_test_j7jgpq7k_.dbf ONLINE
7 rows selected.
SQL> alter database datafile 7 offline;
Database altered.
–物理层移动数据文件
SQL> !mv /oradata/ORCL11G/datafile/o1_mf_test_j7jgpq7k_.dbf /oradata/orcl11g/test02.dbf
SQL> !ls /oradata/orcl11g/test02.dbf
/oradata/orcl11g/test02.dbf
–逻辑层rename数据文件
SQL> alter database rename file ‘/oradata/ORCL11G/datafile/o1_mf_test_j7jgpq7k_.dbf’ to ‘/oradata/orcl11g/test02.dbf’;
Database altered.
–恢复数据文件
SQL> recover datafile 7;
Media recovery complete.
–online数据文件
SQL> alter database datafile 7 online;
Database altered.
SQL> select file#,name,status from v$datafile;
FILE# NAME STATUS
———- ———————————————————— ——-
1 /oradata/orcl11g/system01.dbf SYSTEM
2 /oradata/orcl11g/sysaux01.dbf ONLINE
3 /oradata/orcl11g/undotbs01.dbf ONLINE
4 /oradata/orcl11g/users01.dbf ONLINE
5 /oradata/orcl11g/example01.dbf ONLINE
6 /oradata/orcl11g/test01.dbf ONLINE
7 /oradata/orcl11g/test02.dbf ONLINE
7 rows selected.

© 版权声明

相关文章