Oracle Data File Management

Source: Internet
Author: User

1. Manually change the data file size

SQL> conn/as sysdba

SQL> Createtablespace exampletb Datafile 'e: \ examp01.dbf' size 10 M;

SQL> alter database datafile 'e: \ examp01.dbf' resize 20 m;

SQL> alter database datafile 'e: \ examp01.dbf' resize 9 m;

2. Add data files to the tablespace

SQL> alter tablespace exampletb add datafile 'e: \ examp02.dbf' size 10 M;

3. delete data files from tablespace

SQL> alter tablespace exampletb drop datafile 'e: \ examp02.dbf ';

4. Set the tablespace to read-only and read-write modes.

SQL> CREATETABLE scott. student (id NUMBER (5), name VARCHAR2 (10) TABLESPACE exampletb;

SQL> insertinto scott. student (id, name) values (1, 'Lucy ');

SQL> alter tablespace exampletb read only;

SQL> insertinto scott. student (id, name) values (2, 'lily ');

SQL> select * from scott. student;

SQL> alter tablespace exampletb read write;

SQL> insertinto scott. student (id, name) values (2, 'lily ');

5. Set the tablespace to online or offline.

SQL> alter tablespace exampletb offline;

SQL> select * from scott. student;

SQL> alter tablespace exampletb online;

SQL> select * from scott. student;

6. query table space and data files

SQL> select * from v $ tablespace;

SQL> select * from dba_tablespaces;

SQL> select * from v $ datafile;

SQL> select * from dba_data_files;

Related Article

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.