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

Sql statements commonly used in Oracle

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

Share

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

-- 1. Query system tablespace information

SELECT * FROM SYS.DBA_TABLESPACES

2. Query the path information where the tablespace is located

Select * from dba_data_files

3. Query the tablespace to which the user belongs

Select u.username as user name, tablespace from dba_users u to which u.default_tablespace as belongs

4. Create tablespaces

Create tablespace GUEST

Logging

Datafile'D:\ oracle\ oradata\ ORCL\ GUEST.dbf'

Size 100m

Autoextend on

Next 50m maxsize unlimited

Extent management local

5. Create a user and specify a tablespace

Create user GUEST identified by neusoft

Default tablespace GUEST

Temporary tablespace TEMP

-- 6. Grant permissions to users

Grant connect,resource to EPM

-- 7. Query oracle version information 11.2.0.1.0

Select * from product_component_version

-- 8. Create an oracle directory that is not an OS directory

Create or replace directory impdp as'd:\ impdp'

9. Grant directory operation rights to system users

Grant read, write on directory impdp to system

-- 10. Query all directories

Select * from dba_directories

-11. Delete the specified directory

Drop directory impdp

-- 12. Query table data after database import

Select * from epsa.sa_user us where us.REAL_NAME like'% du Shuai%'

-13. Delete users

Drop user epsa cascade

Drop user epm cascade

Drop user flow cascade

Drop user guest cascade

14. Delete the table space and its contents

Drop tablespace epsa including contents

Drop tablespace epm including contents

Drop tablespace flow including contents

Drop tablespace guest including contents

-- 15. If the oralce prompt cannot delete the currently connected user, first query the user's process number, and then force the process to be killed.

Select username,sid,serial# from v$session v where v.USERNAMEMETHER FLOW'

16. Kill the user process

Alter system kill session '18pr 42957'

-17. Delete users

Drop user flow cascade

18. Data pump import command

Impdp system/neusoft@orcl schemas=epsa,epm,flow,guest directory=impdir dumpfile=20141024.dump

19. Data pump export command

Expdp system/neusoft@orcl schemas=epsa,epm,flow,guest directory=impdir dumpfile=20141024.dump logfile=20141024.log version=11.1.0.7.0

Change the expiration of the oracle login password. The oracle default password is valid for 180 days.

Select * from dba_profiles p where p.resourceworthy nameplate PASSWORDLIFEN timekeeper

Alter profile default limit PASSWORD_LIFE_TIME unlimited

Select * from sysdba.dba_table_privs

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