1、su – oracle 不是必需,适合于没有DBA密码时使用,可以不用密码来进入sqlplus界面。: j; r% s. r* M
2、sqlplus /nolog 或sqlplus system/manager 或./sqlplus system/manager@ora9i;' D& h1 `( }! m6 e
3、SQL>connect / as sysdba ;(as sysoper)或
K1 b. }, \$ V+ f, m5 L; j) Wconnect internal/oracle AS SYSDBA ;(scott/tiger)
M3 Y: o0 |( F: W+ rconn sys/change_on_install as sysdba;: H$ z* H9 J+ t% H
4、SQL>startup; 启动数据库实例
; z2 N ?5 C! I2 [; F% M, K" G: j( r. Q5、 查看当前的所有数据库: select * from v$database;
8 [8 ?( m- ?6 Z: e& m8 Q+ H- ~select name from v$database;$ f+ m# t, ^# q: U A c
desc v$databases; 查看数据库结构字段
2 z* ?2 ]/ c* M- r7、怎样查看哪些用户拥有SYSDBA、SYSOPER权限:
9 |/ `3 \7 Y) O) t; l; r- e* `SQL>select * from V_$PWFILE_USERS;6 @ @1 C# M) T$ m1 v1 [
Show user;查看当前数据库连接用户" x, C4 u+ o: F
8、进入test数据库:database test; # p" L5 e6 Y+ }, x4 j1 X/ n! u3 Y
9、查看所有的数据库实例:select * from v$instance;) }: r [" j; `9 G% [1 } d: A$ K
如:ora9i
' e1 o5 V. |5 m6 i10、查看当前库的所有数据表:5 A( f% q* H5 S/ W5 S
SQL> select TABLE_NAME from all_tables; , e1 `( P8 `" z: x+ S/ o8 J" d* n
select * from all_tables; R+ o* I! F; e' k/ A. }
SQL> select table_name from all_tables where table_name like '%u%';
2 A0 z( D- O8 A
7 N+ {4 ]' Q$ T% b5 o1 UTABLE_NAME
8 u7 B9 T+ K. B0 A6 P- G------------------------------6 U7 K# Y7 h/ M
_default_auditing_options_
' y# D' p; z) ?3 ?! V N& m. D2 }4 q% a' V* n
11、查看表结构:desc all_tables;
& x; \1 Y# T8 q& B4 }12、显示CQI.T_BBS_XUSER的所有字段结构:
; Y7 i, w5 u3 xdesc CQI.T_BBS_XUSER; + l- @! P7 r% a1 f, @5 s9 j Q
13、获得CQI.T_BBS_XUSER表中的记录:
. f: _3 {$ d1 ?! J5 _6 W3 iselect * from CQI.T_BBS_XUSER; * G% h; o2 X1 k/ h$ F# ?5 [
14、增加数据库用户:(test11/test)3 q' @8 K3 o; ?% V: F, w+ M
create user test11 identified by test default tablespace users Temporary TABLESPACE Temp;/ t* J" p8 G0 b' f1 r
15、用户授权: q9 _+ n: e" {
grant connect,resource,dba to test11;; a! Z& Z# U% l u8 v
grant sysdba to test11;
% J+ A' b% E* h W: q; Fcommit;4 x5 {( g N9 ?
16、更改数据库用户的密码:(将sys与system的密码改为test.)) @' |2 e" A. t# T4 Y4 T
alter user sys indentified by test;$ c- {' c: U; t! B8 D
alter user system indentified by test; 3 y* ]8 c* C* {0 L5 T" P8 p
|