Deleting databases-with DROP database Statement

Source: Internet
Author: User

Oracle 10g adds the drop database command, which makes it much easier for us to delete the databases. However, there are certain restrictions on the drop database:

Some errors

1.ora-01586:database must is mounted EXCLUSIVE and not open for this operation
Sql> Conn/as SYSDBA
Connected.
sql> drop database;
Drop database
*
ERROR at line 1:
Ora-01586:database must is mounted EXCLUSIVE and not open for this operation

2. Ora-12719:operation requires database is in RESTRICTED mode
Sql> ALTER DATABASE close;
Database altered.
sql> drop database;
Drop database
*
ERROR at line 1:
Ora-12719:operation requires database is in RESTRICTED mode

Solutions

Sql> ALTER DATABASE close;
Sql> alter system enable restricted session;
System altered.

sql> drop database;
Database dropped.

or the right command.

Sql>startup Mount

Sql>alter system enable restricted session;

Sql>drop database;



constraints (SQL Reference original):
Drop database

    • You must has the SYSDBA system privilege to issue this statement.
    • The databasemust is mounted in exclusive and restricted mode
    • It must be closed.


Restricted mode:
The RESTRICTED SESSION clause lets you restrict logon to Oracle.
You can use this clause regardless of whether your instance have the database dismounted or mounted, open or closed.

Restricting Session logons:

Example want to restrict logons if you is performing application maintenance and you want only application Develo Pers with RESTRICTED SESSION system privilege to log on.

To restrict logons, issue the following statement:
ALTER SYSTEM ENABLE RESTRICTED SESSION;
You can then terminate any existing sessions using the KILL SESSION clause of the ALTER SYSTEM statement.
After performing maintenance in your application, issue the following statement to allow any user with CREATE SESSION syst EM privilege to log on:ALTER SYSTEM DISABLE RESTRICTED SESSION;
RESTRICTED SESSION, allows you to log into the database in a constrained manner. You can use this clause regardless of whether the database is mounted or open.

Summary-There are four points:

1, have SYSDBA permission.
2. Data is mounted in a unique way, Oracle startup exists in two ways: exclusive and shared, the exclusive boot option is exclusive, which means that only one routine is allowed to use the data. Shared-boot parameters are shared, which means that multiple routines are allowed to use the database in parallel.
3. Log in to the database restricted SESSION.
4. The database is in a closed state.


DROP database The role of the command:

    • When you issue this statement, Oracle database drops the database and deletes all control files and datafiles listed in th E control file.
    • If the database used a Serverparameter file (SPFile), it is also deleted.
    • Archived logs and backups is not removed, but can use the Recovery Manager (RMAN) to remove them.
    • If the database is on raw disks, this statement does not delete the actual raw disk special 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.