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: Maximum permissions, 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 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. Only 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 common commands

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 output the screen clipped by spool and spool off 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, if not added, will be the original C:\1.txt cover, this is a new feature of 10G ,

The previous database version cannot be continued, only the new file name can be specified.

Run

Run the SQL statement in the sqlplus buffer, which can be abbreviated as R

/

Same as the Run command, run the SQL statement in the sqlplus buffer

@ Script

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

The meaning of the statement is to run the specified script.

@@ 为 a script that runs relative paths, typically used 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

Comments

--is the comment when moving forward

/* * is a comment on multiple lines

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

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

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.