找回密码
 立即注册
欢迎中测联盟老会员回家,1997年注册的域名
查看: 1871|回复: 0
打印 上一主题 下一主题

oracle数据库常用命令

[复制链接]
跳转到指定楼层
楼主
发表于 2012-9-13 16:42:40 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
1、su – oracle 不是必需,适合于没有DBA密码时使用,可以不用密码来进入sqlplus界面。
! v4 c" T" _+ \) R- p2、sqlplus /nolog 或sqlplus system/manager 或./sqlplus system/manager@ora9i;& e2 j% {7 B- q+ s9 l! f) Q
3、SQL>connect / as sysdba ;(as sysoper)或
+ q: K- R2 H4 {3 O3 M  S1 W* u2 }connect internal/oracle AS SYSDBA ;(scott/tiger)
& W% r" X$ k% x/ f* T+ tconn sys/change_on_install as sysdba;1 N! r2 \. y; R- t& U/ |. D
4、SQL>startup; 启动数据库实例
5 O; B- @2 Q4 Q5、 查看当前的所有数据库: select * from v$database;
2 n6 e, I- h; Z8 Y$ W9 i: Eselect name from v$database;: d! |7 m0 \) t
desc v$databases; 查看数据库结构字段* c0 H1 G/ C0 N6 ^6 u
7、怎样查看哪些用户拥有SYSDBA、SYSOPER权限:
9 W1 ?/ \1 O/ @0 p) m# ]SQL>select * from V_$PWFILE_USERS;
* P0 ~7 y% L+ W: N5 n% yShow user;查看当前数据库连接用户0 c2 b, b6 |$ S& B0 L
8、进入test数据库:database test;
1 o' j! d3 P5 f  u& p" M& q9、查看所有的数据库实例:select * from v$instance;
# X& _" f0 D5 ?& k+ d  V. s如:ora9i0 _8 W8 l( T0 D# A; a
10、查看当前库的所有数据表:' h8 y% S- M5 f. ?) x
SQL> select TABLE_NAME from all_tables;
7 s; G# [9 I) v# {6 z, h3 P* W, @select * from all_tables;
  Y' m* l, ~, u' WSQL> select table_name from all_tables where table_name like '%u%';
! L# Z& v+ u& T' P8 M
0 H" v! h# U# xTABLE_NAME$ m  r/ _6 O  D& m# ^
------------------------------4 G! E7 T9 @$ x  m: r$ N; @
_default_auditing_options_& C. V9 k6 L( Y
" F, [  G8 _" p7 H/ C1 X1 J# Z: e
11、查看表结构:desc all_tables;2 @! O+ f; z! n
12、显示CQI.T_BBS_XUSER的所有字段结构:
  }( z# l4 L  @3 U0 H6 N5 ldesc CQI.T_BBS_XUSER;
8 f7 a0 h/ l% Y9 P13、获得CQI.T_BBS_XUSER表中的记录:3 B4 k& a9 P. K1 i8 w9 f" {) E
select * from CQI.T_BBS_XUSER;
, O& e/ I2 N3 }" x# t( h5 q14、增加数据库用户:(test11/test)
+ [* Y! S5 t3 I$ {( x, q  j+ _create user test11 identified by test default tablespace users Temporary TABLESPACE Temp;% t% F  m9 d2 d, P0 U
15、用户授权: & F# z2 ^3 _# |" v* V
grant connect,resource,dba to test11;
1 @7 n6 c- R4 o' Ygrant sysdba to test11;9 s* g1 u. X$ q) j( c1 A
commit;
  n0 |* C+ v3 y( j: l! n# {: v/ ~16、更改数据库用户的密码:(将sys与system的密码改为test.)3 ?+ r# G) U. D7 h4 o# t: @
alter user sys indentified by test;
( ?2 S, s, M" \: H$ ualter user system indentified by test;
* W# j" C6 u- q2 E/ w! V" m
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表