碰到空間不夠使怎辦?DBF轉移也是一個辦法。
本實驗成功了,但有一個疑問:systaux tablespace offline不確定是否造成其它數據無法訪問。
https://blog.csdn.net/xionglang7/article/details/8284152,參考這裏,但後面還有沒做實驗了。
實驗開始:
SQL> alter tablespace system offline;
alter tablespace system offline
*
ERROR at line 1:
ORA-01541: system tablespace cannot be brought offline; shut down if necessary
看來system無法在線操作,不拿system下手了。
SQL> alter tablespace sysaux offline;
Tablespace altered.
SQL> alter tablespace sysaux rename datafile '/opt/oracle/oradata/ORCL/sysaux01.dbf' to
'/home/oracle/sysaux01.dbf';
alter tablespace sysaux rename datafile '/opt/oracle/oradata/ORCL/sysaux01.dbf' to
'/home/oracle/sysaux01.dbf'
*
ERROR at line 1:
ORA-01525: error in renaming data files
ORA-01141: error renaming data file 3 - new file '/home/oracle/sysaux01.dbf'
not found
ORA-01110: data file 3: '/opt/oracle/oradata/ORCL/sysaux01.dbf'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 7
看起來,目標端,必須先有東西啊。回到根目錄下,su - oracle
[oracle@ora116 ~]$ cp /opt/oracle/oradata/ORCL/sysaux01.dbf /home/oracle/sysaux01.dbf;
因爲tablespace已經offline了,所以應該不會造成數據不一致。
SQL> alter tablespace sysaux rename datafile '/opt/oracle/oradata/ORCL/sysaux01.dbf' to
'/home/oracle/sysaux01.dbf';
Tablespace altered. 居然可以啊,興奮中
SQL> alter tablespace sysaux online;
Tablespace altered.
重啓看看是否正常?
SQL> shutdown immediate;
ORA-01097: cannot shutdown while in a transaction - commit or rollback first
SQL> commit;
Commit complete.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.
Total System Global Area 1258291200 bytes
Fixed Size 8792296 bytes
Variable Size 822085400 bytes
Database Buffers 419430400 bytes
Redo Buffers 7983104 bytes
Database mounted.
Database opened.
成功啦!把原來的/opt/oracle/oradata/ORCL/sysaux01.dbf刪除,再重啓,還是正常!喝酒去了