Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Oracle sqlplus common commands

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

I. sys users and system users

Oracle installation automatically generates sys and system users

(1) sys user is a super user with the highest privileges, sysdba role and create database permissions. The default password for this user is change_on_install.

(2) system users are administrative operators and have a lot of authority. Has sysoper role, does not have the permission of create database, and the default password is manager

(3) generally speaking, for database maintenance, you can log in with system users.

Note: that is to say, the biggest difference between sys and system is whether they have permission to create database or not.

II. Brief introduction of sqlplus tools

Sqlplus is a tool that comes with oracle, which is mainly used to execute sql statements, pl\ sql blocks.

Do the following:

(1) sqlplusw.exe in the D:\ dev\ oracle\ product\ 10.2.0\ db_1\ bin\ directory. (d:\ dev\ oracle\ is the oracle installation directory)

(2) enter "sqlplusw" in the running bar

III. Brief introduction of sqlplus dos tools

(1) Overview: sqlplus is a tool for operating oracle under dos, and its function is similar to sqlplus.

(2) the operation is as follows: enter "sqlplus" in the operation bar.

4. PLSQL Developer tools need to be installed by yourself. We recommend you to use them.

Fifth, sqlplus common commands

1), connection command

1.conn [ect]

Usage: conn username / password @ network service name [as sysdba/sysoper]

Note: when connecting as a privileged user, you must bring as sysdba or as sysoper with you

Eg 、

SQL > show user

USER is "SCOTT"

SQL > conn system/oracle@orcl

Connected.

SQL > show user

USER is "SYSTEM"

SQL >

The above command achieves a similar effect of 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 change the user's password. If you want to change the password of other users, you need to log in with sys/system.

Eg 、

SQL > conn scott/oracle

Connected.

SQL > passw

Change the password of SCOTT

Old password:

New password:

Retype the new password:

The password has been changed

SQL >

4.show user

Description: displays the current user name

5.exit

Description: this command disconnects from the database and exits sqlplus

5.clear screen empties the screen

2), file operation command

1.start and @ br/ > clear the screen

2), file operation command

1.start and @

Case: sql > @ d:\ a.sql or sql > start d:\ a.sql

2.edit

Description: this command can edit the specified sql script

Case: sql > edit d:\ a.sql, which opens the file d:\ a.sql

3.spool

Description: this command can output the contents of the sqlplus screen to the specified file.

Case: sql > spool d:\ b.sql and enter sql > spool off

Eg 、

Sql > spool d:\ b.sql

Sql > select from emp

Sql > spool off

3), interactive command

1. &

Description: you can replace a variable, which requires user input when it is executed.

Select from emp where job='&job'

4), display and set environment variables

Overview: can be used to control the various formats of the output, set show if you want to permanently save the relevant settings

Set, you can modify the glogin.sql script

1.linesize

Description: sets the width of the display line. The default is 80 characters.

Show linesize

Set linesize 90

2.pagesize description: sets the number of rows displayed per page. Default is 14.

Use the same as linesize

The use of other environmental parameters is more or less the same.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report