oracle 笔记sqlplus

create user xiaoming identified by 123;

password xiaoming;

drop user xiaoming;

grant connect to xiaoming [with admin option];

conn xiaoming/123

grant resource to xiaoming;//可以建表了

create table test(userid varchar2(30),username varchar2(30));

grant select/update/all on emp to xiaoming [with grant option  可以把权限传递]

revoke select on emp from xiaoming

权限传递中上级被回收 ,下级也被 回收了

select * from scotte.emp;

role:

connect/dba/resource

用户管理

创建profile文件 只能试3次,锁定2天
create profile lock_account limit failed_login_attempts 3 password_lock_time 2;
alter user scotte tee profile lock_account;

alter user scott account unlock;
终止口令 每10天要改密码,宽限2天
create profile myprofile limit password_life_time 10
password_grace_time 2;
alter user scott profile myprofile;
口令历史
create profile password_history limit password_life_time 10 password_grace_time 2 password_reuse_time 10
drop profile password_history

表的管理

基本查询

alter session set nls_date_format='yyyy-mm-dd';
create table student(
xh char(4),
xm varchar2(20),
sex char(2),
birthday date,
sal number(7,2)
);

col ename heading “名字” format a40

select sal*3+nvl(comm,0)*13  "anumal sal",ename from emp;

原文地址:https://www.cnblogs.com/anjuncc/p/5827329.html