中国网络渗透测试联盟
标题:
oracle数据库常用命令
[打印本页]
作者:
admin
时间:
2012-9-13 16:42
标题:
oracle数据库常用命令
1、su – oracle 不是必需,适合于没有DBA密码时使用,可以不用密码来进入sqlplus界面。
* D9 p5 y* Q( ~: D2 r; O! M
2、sqlplus /nolog 或sqlplus system/manager 或./sqlplus system/manager@ora9i;
3 P2 E& ^9 ?/ s- ?: D" c' u, t
3、SQL>connect / as sysdba ;(as sysoper)或
' |; d6 P, ]9 a. r5 o: C4 ]
connect internal/oracle AS SYSDBA ;(scott/tiger)
+ X3 f" H2 v& O2 S
conn sys/change_on_install as sysdba;
' K( I1 V: s8 q5 v$ H
4、SQL>startup; 启动数据库实例
- O o1 V. ?+ r/ L$ X4 x5 v% H
5、 查看当前的所有数据库: select * from v$database;
: u! o( `/ e" R' S, i# T
select name from v$database;
4 {" C; P; n6 A, b9 z
desc v$databases; 查看数据库结构字段
' j& x F: e, y# E- M
7、怎样查看哪些用户拥有SYSDBA、SYSOPER权限:
' c* {( h7 c- V3 d9 ~
SQL>select * from V_$PWFILE_USERS;
0 g% H; b: y' D8 ^( h+ h$ B/ @* j
Show user;查看当前数据库连接用户
! `4 `6 `' e" U. A' h2 H" D* `& ^& H
8、进入test数据库:database test;
# J4 P% l2 S, W: m1 R
9、查看所有的数据库实例:select * from v$instance;
4 p- @" a% x" f4 |# M' e3 o
如:ora9i
# _. u4 T- d. J+ r/ Y" n
10、查看当前库的所有数据表:
5 Z8 t9 U* M; U. M' \
SQL> select TABLE_NAME from all_tables;
2 h/ i8 V! V2 U
select * from all_tables;
/ y* _2 F/ h8 t
SQL> select table_name from all_tables where table_name like '%u%';
' x( n" S: w; i& Y' E
2 [1 U. N3 d9 o! Z
TABLE_NAME
& e7 Z2 b7 n+ m, a* [4 S+ s7 W
------------------------------
" P2 u0 N7 F+ ?
_default_auditing_options_
# {' C1 K( K% ?; [8 t- S$ g2 c
4 O: j7 f5 j8 h
11、查看表结构:desc all_tables;
* E8 O' r; N# @4 H
12、显示CQI.T_BBS_XUSER的所有字段结构:
5 ], b! S1 Z4 u
desc CQI.T_BBS_XUSER;
; W8 d9 Q6 C! B# Y! k& t$ R
13、获得CQI.T_BBS_XUSER表中的记录:
! S5 x0 Z0 R- m% `/ f4 P: A
select * from CQI.T_BBS_XUSER;
( J$ j6 f R1 T# X
14、增加数据库用户:(test11/test)
1 o$ Q! b* o9 K! [: M
create user test11 identified by test default tablespace users Temporary TABLESPACE Temp;
6 d3 p; V3 H6 _2 R* E7 V
15、用户授权:
. S. w7 U. r5 u& w) D& U
grant connect,resource,dba to test11;
& `3 Z* f( ~" H, K9 @- Z. ~4 J8 d
grant sysdba to test11;
) a5 ^% y* J! ?1 u" Q+ T. }& \% z
commit;
9 t, X+ r: h$ c; ~# j
16、更改数据库用户的密码:(将sys与system的密码改为test.)
& |" a7 Y7 \( x8 N$ u l
alter user sys indentified by test;
# w8 ]5 s, o7 z f& |/ l
alter user system indentified by test;
; i5 P' F6 n2 R) J5 V; q# e
欢迎光临 中国网络渗透测试联盟 (https://www.cobjon.com/)
Powered by Discuz! X3.2