- create:
create tablespace users datafile ‘/ora01/oracle/oradata/booktst_users_01.dbf’ size 50m autoextend on next 10m maxsize 100m;
- resize:
alter tablespace data datafile '/path/to/file.dbf' resize 200M;
- alter
- move tablespace data file (2 ways: database way or tablespace way)
note: tablespace must not be system tablespace
data file can be moved to new place during the instance is running.
- set tablespace as offline. (alter tablespace tbsname offline;)
- use OS commands to move file to new place(mv)
- use alter tablespace command to rename filename in database (alter tablespace tbsname rename datafile '/path/to/file1.dbf' to '/path/to/file2.dbf';)
- set tablespace status to online (alter tablespace tbsname online;)
note: can be any data file (tablespace, online redo log file)
- shutdown immediate
- use OS commands to mv /path1/data1.dbf to /path2/data2.dbf
- startup mount
- alter database rename file '/path1/file1.dbf' to '/path2/file2.dbf'
- alter database open;
- add:
- delete:
note: if tablespace got data inside, then using 'including contents and datafiles' keyword; this command won't delete tablespace datafile, you need to use operating system command to delete it.
- missing tablespace datafile, cannot start up oracle database:
shutdown abort
startup mount
alter database datafile '/directory/filename' offline drop;
alter database open;
drop tablespace ts_name;
In the above steps, you tell Oracle that the missing datafile is now missing (offline drop). You should then be able to open the database. Once open, you should be able to drop the tablespace with the missing datafile. You can then recreate the tablespace.
No comments:
Post a Comment