Oracle Tutorials-Common commands (ii)

Source: Internet
Author: User
Tags clear screen

Oracle Sql*plus Common Commands

One, sys users and system users
The Oracle installation automatically generates SYS users and system users
(1), sys user is superuser, has the highest privileges, has the SYSDBA role, has the rights to create database, the user's default password is Change_on_install
(2), the system user is the management operator, the authority is also very large. With the Sysoper role, without the CREATE DATABASE permission, the default password is the manager
(3), generally speaking, the database maintenance, using the system user login can pull
Note: The biggest difference between SYS and system two users is that there is no permission to create database.
                  
ii. Introduction of Sql*plus Tools
Sql*plus is Oracle's own tool software, primarily used to execute SQL statements, Pl\sql blocks.
The operation is as follows:
(1), in the D:\dev\oracle\product\10.2.0\db_1\bin\ directory of the Sqlplusw.exe. (D:\dev\oracle\ for Oracle installation directory)
(2), enter "SQLPLUSW" in the Run bar to

Three, Sqlplus DOS tool introduction
(1), overview: Sqlplus is the tool that operates Oracle under DOS, its functions and sql*plus are similar.
(2), operate as follows: Enter "Sqlplus" in the Run bar to

Four, Plsql developer tools, need to install themselves, recommend everyone to use

V. Sql*plus COMMON Commands

The most common is/executes the previous statement


1), connect command
1.conn[ect]
USAGE: Conn User name/password @ NETWORK SERVICE name [as Sysdba/sysoper]
Note: When connecting with a privileged user, you must bring as SYSDBA or as Sysoper
eg,
sql> Show User
USER is "SCOTT"
sql> Connsystem/[email protected]
is connected.
sql> Show User
USER is "SYSTEM"
sql>
the above command achieves the same effect as switching users
2.disc/disconn/disconnect
Description: This command is used to disconnect from the current database
3.pssw[ord]
Note: This command is used to modify the user's password, and if you want to modify another user's password, you need to log in with Sys/system.
eg,
sql> Conn Scott/oracle
is connected.
sql> PASSW
change SCOTT's password
Old Password:
New Password:
Retype the new password:
Password has changed
sql>
4.show User
Description: Displays the current user name
5.exit
Description: The command disconnects from the database and exits the Sql*plus
5.clear Screen
Clear Screen

2), file Operation command
1.start and @
Description: Run SQL script
case: sql>@ d:\a.sql or Sql>start d:\a.sql
2.edit
Description: The command can edit the specified SQL script
case: Sql>edit d:\a.sql, this will open the D:\a.sql file.
3.spool
Note: This command can output the contents of the Sql*plus screen to the specified file.
case: Sql>spool d:\b.sql and input sql>spool off
eg,
Sql>spool D:\b.sql;
Sql>select * from EMP;
Sql>spool off;

3), interactive commands
1.&
Note: You can override a variable, which needs to be entered by the user when it executes.
SELECT * from emp where job= ' &job ';

4), display and set environment variables
Overview: Can be used to control the output of various formats, set show if you want to permanently save the relevant set
You can modify the Glogin.sql script.
1.linesize
Description: Sets the width of the display line, which is 80 characters by default
Show Linesize
Set Linesize 90

2. Set the column width

Col Field name for A9--When the field name is a character, a is used to represent a string, and 9 is represented as a 9-bit

Col Field name for 9999--When the field name is a number, 9 for 0 to 9 and four 9 for 4 digits

3.pagesize Description: Sets the number of rows displayed per page, default is 14
Usage is the same as linesize.
The use of other environmental parameters is similar

5) Modify the command


Source: <http://www.cnblogs.com/linjiqin/archive/2012/01/30/2331843.html>  

From for notes (Wiz)

Oracle Tutorials-Common commands (ii)

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.