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

Management of Oracle

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

Share

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

Start and stop Oracle

To stop and start oracle, you need to switch to the oracle user. No other users have this permission.

Run sqlplus but do not log in to oracle:sqlplus / nolog

Connect to the oracle server with system administrator privileges: conn / as sysdba

Start Oracle:startup

Listener of Oracle

The listener of Oracle, which is equivalent to the TCPserver of oracle, will listen on port 1521. All orac client require listener to connect to the oracle server.

Start: exit sql, enter lsnrctl to enter the interface, start, enter. If you see success, you can start quit successfully, and other users can connect to oracle server through listener.

Close the database: first: sqlplus / nolog connection: conn / as sysdba

Turn off: shutdown

Shutdown parameter description:

-normal shuts down normally

-immediate shuts down immediately

-abort gives up everything and shuts down immediately

-transacitional: affect clients as little as possible to prevent customers from losing information

Sqlplus is one of the most commonly used tools, with strong functions, mainly including:

1. Database maintenance, which is generally operated on the server and cannot be operated remotely

two。 Execute sql statement execute pl/sql

3. Execute sql script

4. Export of data, report

5. Application development, testing sql/plsqp

6. Generate a new sql script

7. For application calls, such as the installation of scripts in the installer

8. User management and authority maintenance, etc.

Common commands:

Conn:conn username / password @ Network Service name

Show user: the description shows the current user

@ script.sql: description: execute the specified sql script file

Quit description: this command disconnects from the database and exits sqlplus

Log in to oracle:

Method 1:sqlplus username / user password @ username

Method 2:conn username / user password @ username

Spool:

This command outputs the contents of the sqlplus screen to a specified file

Case study:

Sql > spool a.txt

Select * from tablename

Sql > spool off

A.txt files are generated in the current directory

Linesize: sets the width of the display line. Default is 80 characters.

Sql > show linesize

Sql > set linesize 90

Pagesize: sets the number of rows displayed per page, which defaults to 14, using the same as linesize. The use of other environmental parameters is more or less the same.

Character set display configuration:

Sqlplus determines the display language through the NLS_LANG environment variable in .bash _ profile

NLS_LANG= "SIMPLIFIED CHINESE_CHINA.ZHS16GBK"

Stands for traditional Chinese gbk

NLS_LANG= "SIMPLIFIED CHINESE_CHINA.AL32UTF8"

Stands for simplified Chinese utf-8

The character set of oracle server in sqlplus

Select usereny ('language') from dual

Create user (create user):

To create a new user in oracle to use the create user statement, you can only use it if you have dba (database administrator) privileges.

Basic syntax: create user username identified by password

Create user dbuser1 identified by dbuser1

User entitlement grant:

Overview: the new users created do not have any permissions, or even the permissions to log in to the database, so you need to specify the appropriate permissions for them. Give a user permission to use the command grant, and reclaim permission to use the command revoke

Basic syntax: grant permissions / roles to users

Grant connent,resource to dbuser1

Change password: if you change your password for yourself, you can use it directly.

-password user name

If you change the password for someone else, you need to have the permission of dba or the system permission of alter user.

Alter user username identified new password

Delete user: drop user username

Overview: class one deletes a user as dba

General: drop user user name

Drop user dbuser1

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