Summary of commands such as Oracle creation/deletion, import/export

Source: Internet
Author: User
Create a temporary tablespace: createtemporarytablespacezfmi_temptempfileD: empty; The tempfile parameter must have the space to create a data table: createtablespacezfmilogging

// Create temporary tablespace zfmi_temp tempfile 'd: oracleoradatazfmizfmi_temp.dbf 'size 32 m autoextend on next 32 m maxsize 2048 m extent management local; // The tempfile parameter must contain // create tablespace zfmi logging

// Create a temporary tablespace

Create temporary tablespace zfmi_temp

Tempfile 'd: oracleoradatazfmizfmi_temp.dbf'

Size 32 m

Autoextend on

Next 32 m maxsize 2048 m

Extent management local;

// The tempfile parameter must have

// Create a data table space

Create tablespace zfmi

Logging

Datafile 'd: oracleoradatazfmizfmi. dbf'

Size 100 m

Autoextend on

Next 32 m maxsize 2048 m

Extent management local;

// The datafile parameter must have

// Delete the user and all objects of the user

Drop user zfmi cascade;

// The cascade parameter is used to cascade the deletion of all objects of the user. if the user has an object but does not add this parameter, the user cannot delete it. Therefore, this parameter is habitually added.

// Delete the tablespace

Prerequisites: before deleting a tablespace, make sure that the tablespace is not used by other users before deleting it.

Drop tablespace zfmi including contents and datafiles cascade onstraints;

// Including contents deletes the content in the tablespace. If the content in the tablespace is not added before the tablespace is deleted, the tablespace cannot be deleted. Therefore, this parameter is habitually added.

// Including datafiles Delete the data files in the tablespace

// Cascade constraints

If the tablespace file is deleted before the tablespace is deleted, the solution is as follows:

If the data file corresponding to the tablespace is deleted before the tablespace is cleared, the database cannot be started or shut down normally.

You can use the following method to restore data (this method has been verified in oracle9i ):

In the following process, filename is a deleted data file. If there are multiple data files, it needs to be executed multiple times. tablespace_name is the name of the corresponding tablespace.

$ Sqlplus/nolog

SQL> conn/as sysdba;

If the database has been started, run the following line first:

SQL> shutdown abort

SQL> startup mount

SQL> alter database datafile 'filename' offline drop;

SQL> alter database open;

SQL> drop tablespace tablespace_name including contents;

// Create a user and specify the tablespace

Create user zfmi identified by zfmi

Default tablespace zfmi temporary tablespace zfmi_temp;

// The identified by parameter must have

// Grant all permissions for the message user DBA role

Grant dba to zfmi;

// Grant permissions to users

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.