oracle对用户、 表、字段的基本操作
1.创建用户并设置密码
create user username identified by password ;
2.修改用户密码
alter username identified by password ;
3.删除用户
drop user username
4.赋予用户权限
赋予用户所有权限:
grant all privileges to username;
赋予用户部分权限:
grant connect to username;
grant resource to username;
grant create snapshot to username;
grant create synonym to username;
grant create table to username;
grant create view to username;
grant select any table to username;
grant create any trigger to username;
grant create any view to username;
grant select any dictionary to username;
grant unlimited tablespace to username;
5.添加表
create table sys_log (
log_id nvarchar2(36) not null,
create_time number(13) default null,
CONSTRAINT pk_logId PRIMARY KEY (log_id) --指定主键
);
6.为表的某个字段添加索引
create INDEX createTime_index --索引名称
on
sys_log --表名 (create_time --字段名);
7.插入数据
insert into sys_log (log_id,CREATE_TIME) values('1',1528787854000);
8.修改某个字段允许为空
ALTER TABLE 表名 MODIFY 字段名 字段类型 NULL;
9.增加字段
alter table sys_file add(
ip NVARCHAR2(20) default null
);
comment on column sys_file.ip is '上传人的ip';