Oracle uses Sqlplus management

Source: Internet
Author: User
Tags sqlplus

Oracle uses Sqlplus

Installation, one-click installation, very simple. The installation process, be sure to remember the password

To connect to the local server, you can open cmd directly:

Can be directly without landing, if login need to enter the user name, password.

Sqlplus/nolog

You can also note that there are spaces after the slash

Sqlplus/as  SYSDBA

Connection

/  as Sysdba

Sqlplus when you need help, you can use:

Help Index

You can see the following:

View User

user;

Change Password:

Alter User  by System;

user connections

Connect system/system;

Query all schemas

Select  from Dba_users;

Query all the tables under the user:

Select  from where owner='system';

Third, backup and restore

To back up the database:

Exp Demo/demo@orcl buffer=1024file=Full=y

Demo: User name, password

Buffer: Cache Size

File: The specific backup files address

Full: Whether to export all files

Ignore: Ignore error, if table already exists, then overwrite

Exporting the system user in the database to the SYS user's table

Exp Demo/[email protected] file=d:\backup\1.dmp owner= (System,sys)

Export the specified table

Exp Demo/[email protected] file=d:\backup2.dmp tables= (teachers,students)

According to the filter conditions, export

Exp Demo/[email protected] file=d:\back.dmp tables= (table1) query=\ "where filed1 like ' fg% ' \"

You can compress on export:

Add compress=y after the command

Restore the database:

Open cmd directly execute the following command, no more landing sqlplus.

IMP Demo/demo@orclfile=Full=y Ignore=y

Import the specified table:

IMP Demo/demo@orclfile=d:\backup2.dmp Tables=(teachers,students)

Four, solve the problem of 11G, empty table can not be exported

There is a new feature in 11G that does not allocate segment when the table has no data to save space. This way, empty tables are not exported when the data is exported

Workaround:

1, insert a row, and then rollback will produce segment.

The method is to insert data into the empty table and then delete it, resulting in segment. When exporting, you can export empty tables.

2. Set Deferred_segment_creation parameters

The parameter value is true by default, and segment is assigned when false, whether it is an empty table or a non-empty table.

It is important to note that this value is set to no effect on previously imported empty tables, and still cannot be exported, but can only work on the new tables that are created later. You can only use the first method if you want to export an empty table before.

You need to query all the empty tables and then execute the

Select '  '| | table_name| | ' allocate extent; '  from where num_rows=0

Then you can export it again.

Oracle uses Sqlplus management

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.