Create, expand, and delete tablespaces of various types

Source: Internet
Author: User

Permanent tablespace 1. Extended permanent tablespace SQL> alter tablespace users add datafile '/db/Oracle/oradata/yang/users01.dbf' size 100 m; add the data file method SQL> alter database datafile '/db/oracle/oradata/yang/users01.dbf' resize 200 m; how to modify the data file size in a tablespace SQL> alter database datafile '/db/oracle/oradata/yang/users01.dbf'Autoextend on next 10 m maxsize unlimited;Automatic expansion of tablespaces 2 SQL> create tablespace users1 datafile'/Db/oracle/oradata/yang/users01.dbf' size 100 m; 3. Delete permanent tablespace SQL> drop tablespace users1 including currents and datafiles;Delete tablespaces and objects and data files. SQL> drop tablespace users2;Delete only the tablespace SQL> alter tablespace users1 drop datafile '/db/oracle/oradata/yang/users02.dbf'; Delete the data file on the tablespace users1 to restore the tablespace1,Restore the tablespace creation SQL> create undo tablespace undotbs1 datafile '/db/oracle/oradata/yang/undo1.dbf' size 100 m;2,Restore tablespace deletion SQL> drop tablespace undotbs1 including and contents and datafiles;Delete the restored tablespace and the objects and data files. SQL> drop tablespace undotbs1; only Delete tablespaces excluding objects and data files SQL> alter tablespace undotbs1 drop datafile '/db/oracle/oradata/yang/undo1.dbf'; Delete the data files on the restored tablespace3,SQL> alter tablespace undotbs1 add datafile '/db/oracle/oradata/yang/undo02.dbf' size 30 m; add the data file method SQL> alter database datafile '/db/oracle/oradata/yang/undotbs01.dbf' resize 100 m; SQL> alter database datafile '/db/oracle/oradata/yang/undotbs02.dbf'Autoextend on next 10 m maxsize unlimited;Set auto-scaling temporary tablespace for restored tablespace1,Create temporary tablespace SQL> create temporary tablespace temp tempfile '/db/oracle/oradata/yang/temp01.dbf' size 300 m;2, Delete restored tablespace SQL> drop tablespace temp including contents and datafiles;Delete temporary tablespace and the objects and data files. SQL> drop tablespace temp;Delete tablespace only SQL> alter tablespace temp drop tempfile '/db/oracle/oradata/yang/temp01.dbf ';Delete data files in the temporary table3,Extended temporary tablespace SQL> alter tablespace temp add tempfile '/db/oracle/oradata/yang/temp02.dbf' size 100 m; add data file extended temporary tablespace SQL> alter database tempfile '/db/oracle/oradata/yang/temp02.dbf' resize 200 m; SQL> alter database datafile '/db/oracle/oradata/yang/temp02.dbf' autoextend on next 10 m maxsize unlimited; SQL> select tablespace_name from dba_tablespaces; SQL> select file_name from d Ba_data_files; SQL> select name from v $ datafile; SQL> select tablespace_name, file_name from dba_data_filesSql> select tablespace_name, table_name from user_tables where tablespace_name = 'users'; SQL> select tablespace_name, sum (bytes/1024/1024) from dba_data_files group by tablespace_name; SQL> select tablespace_name, sum (bytes/1024/1024) from dba_free_space group by tablespace_name; SQL> select name from v $ temp File; SQL> select tablespace_name, file_name from dba_temp_files ;......

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.