oracle可视化操作界面——plsql dev安装配置与使用
生活随笔
收集整理的這篇文章主要介紹了
oracle可视化操作界面——plsql dev安装配置与使用
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
1. 安裝
32位客戶端需要對(duì)應(yīng)32位plsqldev,64wei對(duì)應(yīng)64位。
2. plsql Dev配置
(1)指定oci.dll文件位置
(2)編譯設(shè)置,鼠標(biāo)在哪一行,按F8自動(dòng)運(yùn)行這一行,知道分號(hào)結(jié)束。
(3)快捷鍵設(shè)置,ctrl+/ 為注釋快捷鍵
3. 常用sql命令
(1)新建sql窗口
(2)命令
-- 創(chuàng)建用戶,用戶名,密碼,指定默認(rèn)表空間 create user sss identified by 123 default tablespace users;-- 解鎖與鎖定用戶 select username,account_status from dba_users; -- 查看當(dāng)前實(shí)例賬戶狀態(tài) alter user sss account lock; -- 鎖定sss賬戶 alter user sss account unlock; -- 解鎖sss賬戶-- 刪除用戶 drop user sss cascade;-- 查看當(dāng)前登錄的用戶角色 select * from user_role_privs;-- 創(chuàng)建表空間 create tablespace test datafile 'D:\OracleData\test.dbf'-- 服務(wù)器上的已經(jīng)存在的數(shù)據(jù)庫(kù)實(shí)例存儲(chǔ)位置 size 10m extent management local autoallocate;-- 創(chuàng)建“學(xué)生”表 create table students( stuno number(10) not null, stuname varchar2(8), sex char(2), age int, departno varchar2(2) not null, classno varchar2(4) not null, regdata date default sysdate );-- 查看表中所有信息 select * from students t;-- 插入數(shù)據(jù) insert into students(stuno,stuname,sex,age,departno,classno) values(2020000001,'王小二','男',16,'一','0102'); insert into students(stuno,stuname,sex,age,departno,classno) values(2020000002,'張三','女',17,'二','0201'); insert into students(stuno,stuname,sex,age,departno,classno) values(2020000003,'李四','男',19,'三','0305');-- 更新符合條件的數(shù)據(jù) update students set classno='0107' where stuname='王小二';-- 刪除符合條件的數(shù)據(jù) delete from students where stuname='李四';/*增加屬性列,刪減用drop代替add,修改用modify*/ alter table students add score int;-- 更新新添加的字段值 update students set score=87 where stuname='王小二'; update students set score=89 where stuname='張三'; update students set score=99 where stuname='李四';-- 分組顯示 select stuname,score from students group by (stuname,score);-- 排序統(tǒng)計(jì) select stuname,score from students order by score desc; -- 降序排列-- 創(chuàng)建表的副本 create table students_copy as select* from students select * from students_copy t;-- 刪除表中的數(shù)據(jù),表還在 delete students_copy; select * from students_copy t;-- 刪除表的內(nèi)容和定義,釋放表的空間 drop table students_copy;-- 將students表添加到users表空間中 alter table students move tablespace users;-- 或者在創(chuàng)建表時(shí)指定表空間,原則上不同類型的數(shù)據(jù)對(duì)象存放在不同的表空間中 create table students_copy (stuno number(10) not null, stuname varchar2(8), sex char(2), age int, departno varchar2(2) not null, classno varchar2(4) not null, regdata date default sysdate, score int) tablespace users; -- 指定表空間 select * from students_copy t;-- 用表賦值另一個(gè)表,注意字段順序要一致 insert into students_copy select * from students;-- 定義表中的主鍵 alter table students add primary key(stuno);-- 在表創(chuàng)建時(shí)就定義主鍵 create table students_1 (stuno number(10) not null, stuname varchar2(8), sex char(2), age int, departno varchar2(2) not null, classno varchar2(4) not null, regdata date default sysdate, score int, primary key(stuno) ) tablespace users; -- 指定表空間describe v&lock;-- 創(chuàng)建排他鎖(整個(gè)表只能一個(gè)人改),oracle默認(rèn)也是悲觀的鎖機(jī)制——排它鎖 lock table students in exclusive mode;-- 創(chuàng)建行級(jí)排他鎖(其他人可以更改表中其他行的數(shù)據(jù),但只能查詢另一個(gè)人正在修改的行) lock table students in row exclusive mode;-- 查看當(dāng)前字符集編碼格式,要注意服務(wù)器和客戶端的編碼格式一致 -- 參見(jiàn)博客https://blog.csdn.net/hyb_1314w/article/details/88690147?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.channel_param select * from V$NLS_PARAMETERS; select userenv('language') from dual;-- ------------------------------------------------ -- 加載excel數(shù)據(jù)(excel數(shù)據(jù)保存為csv格式,不要選UTF8格式的,逗號(hào)分隔) create table persons -- 創(chuàng)建和excel屬性字段一致的表 (code number(4), name varchar2(20), sex varchar2(4), age number(4) ) tablespace users; select * from persons t;/* persons.ctl內(nèi)容如下,手動(dòng)建立,改后綴名為.ctl load data CHARACTERSET ZHS16GBK infile 'D:\land\sql_test\persons.csv' append into table persons fields terminated by ',' (code,name,sex,age)win + r,輸出cmd,打開(kāi)命令窗口,輸入以下內(nèi)容,注意用哪個(gè)用戶建立的表就用那個(gè)用戶導(dǎo)入數(shù)據(jù) sqlldr userid='sys/345@192.168.0.173:1521/test as sysdba' control=D:\land\sql_test\persons.ctl */select * from persons t; -- 查看導(dǎo)入的persons表 -- -------------------------------------------------- ------------------------------------------------ -- 加載txt數(shù)據(jù)(后綴為.txt,空格隔開(kāi)) create table persons1 -- 創(chuàng)建和excel屬性字段一致的表 (code number(4), name varchar2(20), sex varchar2(4), age number(4) ) tablespace users; select * from persons1 t;/* persons1.ctl內(nèi)容如下,手動(dòng)建立,改后綴名為.ctl load data CHARACTERSET ZHS16GBK infile 'D:\land\sql_test\persons1.txt' append into table persons1 (code position(01:04) integer external,name position(06:07) char,sex position(09:10) char,age position(12:13) integer external )win + r,輸出cmd,打開(kāi)命令窗口,輸入以下內(nèi)容,注意用哪個(gè)用戶建立的表就用那個(gè)用戶導(dǎo)入數(shù)據(jù) sqlldr userid='sys/345@192.168.0.173:1521/test as sysdba' control=D:\land\sql_test\persons1.ctl*/select * from persons1 t; -- 查看導(dǎo)入的persons表 -- -------------------------------------------------- ------------------------------------------------ -- 直接用ctl文件加載數(shù)據(jù) create table persons2 -- 創(chuàng)建和excel屬性字段一致的表 (code number(4), name varchar2(20), sex varchar2(4), age number(4) ) tablespace users; select * from persons2 t;/* persons2.ctl內(nèi)容如下,手動(dòng)建立,改后綴名為.ctl load data CHARACTERSET ZHS16GBK infile * append into table persons2 fields terminated by ',' (code,name,sex,age) begindata 1006,張三,女,10 1008,李四,男,15win + r,輸出cmd,打開(kāi)命令窗口,輸入以下內(nèi)容,注意用哪個(gè)用戶建立的表就用那個(gè)用戶導(dǎo)入數(shù)據(jù) sqlldr userid='sys/345@192.168.0.173:1521/test as sysdba' control=D:\land\sql_test\persons2.ctl*/select * from persons2 t; -- 查看導(dǎo)入的persons表 -- ----------------------------------------------(3)中文數(shù)據(jù)的導(dǎo)入問(wèn)題
經(jīng)常會(huì)出現(xiàn)亂碼,這是因?yàn)榫幋a問(wèn)題引起。
首先要查看服務(wù)器的編碼格式:
總結(jié)
以上是生活随笔為你收集整理的oracle可视化操作界面——plsql dev安装配置与使用的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: AppScan下载安装教程
- 下一篇: 初识北京