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

What are the doc commands commonly used in Oracle

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article will explain in detail what doc commands are commonly used in Oracle. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

1. Connect to the database

Ordinary users connect to the database:

Conn scott/tiger-(default username / password), conn means "connection" to connect to the database

Super Admin connection:

Conn sys/sys as sysdba-oracle databases are not case sensitive

2.sql file

Save the sql file

Save c:\ test.txt

Edit sql statements, edit with notepad

Ed c:\ 1.txt-Edit the SQL statement

Ed-directly open the last cached sql statement

Describe the structure of the data table

Desc employee;-Open the structure of the employee employee table

Spool screencap

Spool storage location (d:\ basic query .txt)

Spool off-end screencap

3. Server

Turn on the server

Net start oracleservicebinbo

Turn on the listener

Lsnrctl start

Shut down the server

Net stop oracleservicebinbo

Turn off the listener

Lsnrctl stop

4. User operation

View the role of the current user

SQL > select * from user_role_privs

View the system permissions and table-level permissions of the current user

SQL > select * from user_sys_privs;SQL > select * from user_tab_privs

View the current user's default tablespace

SQL > select username,default_tablespace from user_users

Change users

Conn as sysdbasystsinghuasqlplus "sys/tsinghua as sysdba" conn sys/zl as sysdba

Change user password

Sql > alter user Administrator identified by password

Create a data file for a tablespace

Sql > create tablespace test datafile'd:\ oracle\ binbo.dbf' size 10m

Create a user

Sql > create user username identified by username

View users

Sql > show user

Check to see if the statement is wrong

Show error

Lock the user

Sql > alter user username account lock

Release the user

Sql > alter user username account unlock

Delete user

Sql > drop user zl

Create table permissions for users

Sql > grant create table to user name

Grant administrator authority

Sql > grant dba to user name

Give users login rights

Sql > grant connect to user name

Give users unlimited tablespace permissions

Sql > grant unlinmited tablespace to user name

Take back the authority

Sql > revoke dba from user name

5. View tabl

View all the tables under the user

SQL > select * from user_tables

View a table whose name contains log characters

SQL > select object_name,object_id from user_objectswhere instr (object_name,'LOG') > 0

View the creation time of a table

SQL > select object_name,created from user_objects where object_name=upper ('& table_name')

View the size of a table

SQL > select sum (bytes) / (1024-1024) as "size (M)" from user_segmentswhere segment_name=upper ('& table_name')

View table structure

Desc table name

View the table in the memory area of ORACLE

SQL > select table_name,cache from user_tables where instr (cache,'Y') > 0

Add another tablespace data file

Sql > alter tablespace test add datafile'd:\ oracle\ test1.dbf' size 10m

6. Transaction (TC transaction Control language)

COMMIT-commit and end the transaction

ROLLBACK-undo completed work in a transaction

SAVEPOINT-Mark the points in the transaction that can be rolled back

This is the end of the article on "which doc commands are commonly used in Oracle". I hope the above content can be helpful to you so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.

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