1. 程式人生 > >oracle對使用者、 表、欄位的基本操作

oracle對使用者、 表、欄位的基本操作

1.建立使用者並設定密碼    create user username identified by password ;2.修改使用者密碼    alter usernameidentified by password ;3.刪除使用者    drop user username4.賦予使用者許可權賦予使用者所有許可權: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';