oracle安裝:
先安裝oracle客戶端获茬,配置tnsnames.ora文件喳挑,配置環(huán)境變量TNS_ADMIN,NLS_LANG.
安裝pl/sql曹动; 把oracle客戶端目錄復(fù)制到pl/sql的安裝目錄下
pl/sql配置oracle的主目錄及oci目錄? 工具-首選項(xiàng)-連接
參考文檔:https://www.cnblogs.com/1312mn/p/9214061.html
oracle架構(gòu):
客戶端:用戶進(jìn)程
服務(wù)端:實(shí)例(緩存疚俱,后臺(tái)進(jìn)程(系統(tǒng)監(jiān)控進(jìn)程甸怕,進(jìn)程監(jiān)控书在,寫數(shù)據(jù)進(jìn)程灰伟,重寫日志進(jìn)程)),數(shù)據(jù)庫(kù)文件
要訪問數(shù)據(jù)庫(kù)儒旬,必須先創(chuàng)建實(shí)例栏账,一個(gè)實(shí)例可訪問一個(gè)數(shù)據(jù)庫(kù),也可以多個(gè)實(shí)例訪問數(shù)據(jù)庫(kù)
數(shù)據(jù)庫(kù)邏輯結(jié)構(gòu):數(shù)據(jù)庫(kù)-表空間(系統(tǒng)表空間栈源,用戶表空間)-表/索引/視圖-數(shù)據(jù)段/索引段-區(qū)間-快
參考文檔:https://blog.csdn.net/liudongdong19/article/details/82260842
oracle命令大全
創(chuàng)建表:
create table student(sId varchar(),sName varchar());
刪除表:
drop table student;
重命名表:
alter table student to students ;
增加字段:
alter table students add(ID int);
alter table varchar2(30);
修改字段
alter table students modify(ID number(4));
重命名字段
alter table students rename column ID to newID;
刪除字段
alter table stdudents drop colum ID;
添加主鍵
alter table stdudents add primary key(col);
刪除主鍵
alter table students drop primary key(col);
創(chuàng)建索引
create index idxname on tablename(col..);
刪除索引:
drop index idxname ;
==========================================================================
插入數(shù)據(jù):
insert into students values(所有列的值);
insert into students(列) values(對(duì)應(yīng)的值);
更新數(shù)據(jù)
update students set id = 1 where id= 2 挡爵;
刪除數(shù)據(jù)
delete from students where id = 2;commit; 提交數(shù)據(jù)
rollback;回滾數(shù)據(jù)
delete執(zhí)行后是可以恢復(fù)刪除的數(shù)據(jù)的,但是提交后甚垦,就沒辦法恢復(fù)了茶鹃,刪除會(huì)記錄日志
truncate table 刪除表中所有數(shù)據(jù),不會(huì)記錄日志艰亮,不能恢復(fù)闭翩,刪除很快
數(shù)據(jù)復(fù)制
insert into table(select * fro table2);
復(fù)制表結(jié)構(gòu)
create table? table1 select * from table2 where 1>1 ;
復(fù)制表結(jié)構(gòu)和數(shù)據(jù)
create table table1 select * from table2;
復(fù)制指定字段
create table table1 select id,name from table2 where 1>1 ;
參考:https://www.cnblogs.com/1312mn/p/7799732.html