oracle常用命令 11g

2021-08-07 10:42:56 字數 1141 閱讀 8981

1、ddl(不能回滾)

1.1、create table 建立表

create table test as c_id varchar2(20),...;

1.2、alter table 修改表

alter table test add c_note varchar2(100);--增加字段

alter table test modify c_note varchar2(200);--修改字段

alter table test add constraint pk_test primary key(c_id);--建立主鍵

1.3、drop table 刪除表

drop table test;

1.4、truncate table 刪除表中所有資料行

drop table test;

1.5、create index 建立索引

create index index_test_1 on test(c_id,...);

1.6、drop index 刪除索引

drop index index_test_1;

1.7、create sequence 建立序列

create sequence seq_test

increment by 1 --每次疊加個數

start with 1 --從1開始

nomaxvalue --不設定最大值

nocycle --不循壞

cache 20;--快取數20個

2、dml(手動commit,可回滾)

2.1、insert 將記錄插入到資料庫

insert into test(c_id) values(seq_test.nextval);

insert into test select '1' from dual;--inset into select 方式

2.2、update 修改資料庫的記錄

2.3、delete 刪除資料庫的記錄

oracle 11g常用命令

1.監聽 啟動監聽 lsnrctl start 停止監聽 lsnrctl stop 檢視監聽狀態 lsnrctl status 2.啟動 用oracle使用者進入 su oracle 執行sqlplus命令,進入sqlplus環境,nolog引數表示不登入 sqlplus nolog 以管理員模式進...

oracle 11g常用命令

1.監聽 啟動監聽 lsnrctl start 停止監聽 lsnrctl stop 檢視監聽狀態 lsnrctl status 2.啟動 用oracle使用者進入 su oracle 執行sqlplus命令,進入sqlplus環境,nolog引數表示不登入 sqlplus nolog 以管理員模式進...

oracle 11g常用命令

1.監聽 啟動監聽 lsnrctl start 停止監聽 lsnrctl stop 檢視監聽狀態 lsnrctl status 2.啟動 用oracle使用者進入 su oracle 執行sqlplus命令,進入sqlplus環境,nolog引數表示不登入 sqlplus nolog 以管理員模式進...