您的位置:首页 > 数据库 > Oracle

Oracle的一些简单知识

2009-08-01 18:10 375 查看
Oracle 9默认密码
sys: change_on_install
system: manager
scott: tiger
Oracle 10则不行

Oracle命令行命令:
启动监听服务:lsnrctl start {service} //service 有默认值,因此可以不填

创建用户:
create user zhangsan identified by zhangsan

登录:
zhangsan/zhangsan

授予权限:
grant ession to zhangsan:登录权限
grant create table to zhangsan:创建表权限,但需要使用表空间权限
grant unlimited tablespace to zhangsan:可以无限制地使用表空间
撤销权限:
revoke ...(同授予权限)

查看系统权限:
select * from user_sys_privs

查看用户权限
select * from user_tab_privs;

查看用户对某一列的权限
select * from user_col_privs;

根据角色授权
grant select on mytable to lisi
grant all on mytable to lisi
all: 所有权限

授予所有用户某种权限
grant create any table to public
public: 所有用户

设置宽度
set linesize 400

显示当前用户:
show user

对象权限可以控制到列
授予针对某一列的权限
grant update(name) on mytable to lisi
grant insert(name) on mytable to lisi
但查询和删除不能控制到列
select drop can't be limited to a column/columns

权限的传递:通过管理员选项
grant alter any table to lisi with grant option


角色:权限的集合
create role myrole;

grant create session to myrole;
drop role myrole;
注意:有些系统权限无法直接赋予角色,如unlimited tablespace。
create table create any table
[alter table] alter any table
[drop table] drop any table

数据库的三种验证机制
操作系统验证

文件密码验证
数据库系统验证
sys(sysoper, sysdba) 用户不能使用数据库验证,使用的是操作系统验证,即如果用户在Oracle组里,那么这个用户可以任意链接Oracle。

linux下Oracle的启动过程
lsnrctl start
sqlplus sys/oracle as sysdba
startup

sqlplus scott/tiger

windows下Oracle的启动过程
lsnrtcl start

oradim -starup -sid orcl


更改Oracle sysoper&sysdba的密码
找到Oracle的安装目录product/10.20/db_2/database,在这个目录下有个名为PWDorcl.ora的文件
在命令行下,输入:orapwd file=E:/product/10.20/db_2/database/PWDorcl.ora password=123456 entries=10 (这里没有用户名,因为用户名就是sys用户,【不是当前操作系统用户,就是sys】)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: