时间:2021-07-01 10:21:17 帮助过:15人阅读
创建用户:
create user
zhangsan
identified by 123456
default tablespace lili
temporary tablespace temp;
给用户赋权:
grant connect ,resource to zhangsan;
修改密码:
alter user zhangsan identified by Ly932833;
删除用户:
drop user zhangsan cascade;
drop user zhangsan;
cascade 删除用户下的包括视图、表、索引等都删除了
查询时间:
select sysdate from dual;
select systimestamp from dual;----精确到秒后六位
创建序列:
create sequence t_class_seq start with 3 increment by 2 maxvalue 4999;
查询序列
select * from user_sequences;
查询序列下一个值
select t_class_seq.nextval from dual;
删除序列:
drop sequence t_class_seq;
使用序列自增
begin
insert into t_class values(t_class_seq.nextval,‘8班‘,‘2013‘,sysdate);
insert into t_class values(t_class_seq.nextval,‘9班‘,‘2014‘,sysdate);
insert into t_class values(t_class_seq.nextval,‘10班‘,‘2015‘,sysdate);
insert into t_class values(t_class_seq.nextval,‘11班‘,‘2016‘,sysdate);
insert into t_class values(t_class_seq.nextval,‘12班‘,‘2017‘,sysdate);
end;
增加主键约束:
foreign key(tid) references t_dept(id)
#删除id=5的表
delete from t_class where id=3;
删除表
truncate table t_class;
drop table t_class;
connect resource权限;
grant connect,resource to user;
后用户包括的权限:
CONNECT角色: --是授予最终用户的典型权利,最基本的
ALTER SESSION --修改会话
CREATE CLUSTER --建立聚簇
CREATE DATABASE LINK --建立数据库链接
CREATE SEQUENCE --建立序列
CREATE SESSION --建立会话
CREATE SYNONYM --建立同义词
CREATE VIEW --建立视图
RESOURCE角色: --是授予开发人员的
CREATE CLUSTER --建立聚簇
CREATE PROCEDURE --建立过程
CREATE SEQUENCE --建立序列
CREATE TABLE --建表
CREATE TRIGGER --建立触发器
CREATE TYPE --建立类型
从dba_sys_privs里可以查到:
SQL> select grantee,privilege from
dba_sys_privs
2 where grantee=‘RESOURCE‘ order by
privilege;
GRANTEE PRIVILEGE
------------ ----------------------
RESOURCE CREATE CLUSTER
RESOURCE CREATE INDEXTYPE
RESOURCE CREATE OPERATOR
RESOURCE CREATE PROCEDURE
RESOURCE CREATE SEQUENCE
RESOURCE CREATE TABLE
RESOURCE CREATE TRIGGER
RESOURCE CREATE TYPE
已选择8行。
1.查看所有用户:
select * from dba_users;
select * from all_users;
select * from user_users;
2.查看用户或角色系统权限:
select * from dba_sys_privs;
select * from user_sys_privs;
3.查看用户对象权限:
select * from dba_tab_privs;
select * from all_tab_privs;
select * from user_tab_privs;
4.查看所有角色:
select * from dba_roles;
5.查看用户或角色所拥有的角色:
select * from dba_role_privs;
select * from user_role_privs;
3、 https://archive.sap.com/discussions/thread/3344879 数据库报错链接
oracle的增删查改-----傻瓜式随笔,让你一看就可以操作
标签:https run values nextval truncate ble maxsize read 查看