Oracle Basic Learning Landing sqlplus (i)

Source: Internet
Author: User
Tags clear screen sqlplus

Sqlplus is a very concise management tool developed by Oracle, and Sqlplus is the best and most core Oracle management tool. Sqlplus is simple and efficient, giving up flashy, anti-basics. Using Sqlplus, go to Sqlplus and do a simple operation to familiarize yourself with the use of Oracle's gadget Sqlplus.

Login Sqlplus via system User:

System users:

Sys,system: Highest privilege. SYS is higher than system.

Sysman: For operating Enterprise Manager

Scott:password:tiger

1, how to enter the Sqlplus interface

Enter DOS, and then type such as the following command

C:\>sqlplus/nolog

Enter character interface

C:\>sqlplusw/nolog

Enter the Windows interface, specific to the Windows platform.

/nolog is not meant to be logged in. Just enter the Sqlplus program prompt interface.

Wait for you to enter the command.

2, the basic operation of Sqlplus

Sql>connect/As sysdba or system/(password)

Connect to the highest local account

Sql>help Index

Enter help [topic] for help.

Sql>show All

Displays the environment settings for the current Sqlplus

Sql>show User

Displays the user information that is currently logged on

Sql>desc dba_users

View User Data dictionary

Sql>select username from Dab_users;

To view users in a data dictionary

Sql> Clear Screen

Sometimes sqlplus will show a bit of chaos, the cursor is not at the end, please clear the screen.

Enable Scott Users

Under normal circumstances, Scott is locked and needs to be unlocked.

1. Login to a user (unlock to Scott)

sql> system/(password)

2. Unlock the Scott user with system users

Sql>alert user Scott account unlock;

3. Login with Scott Users

Sql> Connect Scott/tiger;

3, some often use the command

Spool

The command is to input the display of the screen into a text file for viewing, a bit like a screen dump.

SPOOL C:\1.TXT

SELECT * from EMP;

SPOOL OFF

The above three lines will be spool and spool off the screen clip to output to the C:\1.txt file.

Spool C:\1.txt Append

Select * FROM Dept;

Spool off

Add append command meaning is to continue to write c:\1.txt, assuming not add, will be the original C:\1.txt cover. This is a new feature of 10G ,

Once the database version number cannot be continued, only the new file name can be specified.

Run

Executes the SQL statement within the sqlplus buffer. Ability to abbreviate to R

/

As with the Run command, execute the SQL statement in the sqlplus buffer

@ Script

@%oracle_home%\rdbms\admin\utlxplan.sql

The meaning of the sentence is to execute the specified script.

@@ 为 used to execute scripts under relative paths, usually when a large script invokes a small script.

Save

Saves the SQL statement in the current sqlplus buffer to the specified file

such as Save C:\2.txt

Get

The SQL statements in the file are transferred into the sqlplus buffer.

such as Get C:\2.txt

Edit

Edits the SQL statement in the current sqlplus buffer, such as the ED

Gaze

--to gaze upon the path

/* * is gazing at multiple lines

PS: Note that when writing a sentence, add a semicolon ";"

Oracle Basic Learning Landing sqlplus (i)

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.