首页 > 代码库 > sqlplus

sqlplus

sqlplus   /   as sysdba

show user  查看当前是谁登陆

技术分享
[oracle@node1 ~]$ sqlplus  /  as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Mon Jun 5 10:35:05 2017

Copyright (c) 1982, 2009, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> show user
USER is "SYS"
SQL> 
View Code

sys 在oracle中最高权限

解锁scott

alter user scott identified by  tiger account unlock;

scott 用户下有几张表

select * from tab;

连接符的用法:用查询生成批量操作的命令

select ‘drop table ‘||tname||‘;‘ from tab;

技术分享
SQL> select drop table ||tname||; from tab;

DROPTABLE||TNAME||;
------------------------------------------
drop table BONUS;
drop table DEPT;
drop table EMP;
drop table SALGRADE;

SQL> select * from tab;

TNAME                   TABTYPE    CLUSTERID
------------------------------ ------- ----------
BONUS                   TABLE
DEPT                   TABLE
EMP                   TABLE
SALGRADE               TABLE

SQL> 
View Code

 

sqlplus