日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

oracle可视化操作界面——plsql dev安装配置与使用

發布時間:2023/12/10 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 oracle可视化操作界面——plsql dev安装配置与使用 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1. 安裝
32位客戶端需要對應32位plsqldev,64wei對應64位。

2. plsql Dev配置
(1)指定oci.dll文件位置

(2)編譯設置,鼠標在哪一行,按F8自動運行這一行,知道分號結束。

(3)快捷鍵設置,ctrl+/ 為注釋快捷鍵

3. 常用sql命令
(1)新建sql窗口

(2)命令

-- 創建用戶,用戶名,密碼,指定默認表空間 create user sss identified by 123 default tablespace users;-- 解鎖與鎖定用戶 select username,account_status from dba_users; -- 查看當前實例賬戶狀態 alter user sss account lock; -- 鎖定sss賬戶 alter user sss account unlock; -- 解鎖sss賬戶-- 刪除用戶 drop user sss cascade;-- 查看當前登錄的用戶角色 select * from user_role_privs;-- 創建表空間 create tablespace test datafile 'D:\OracleData\test.dbf'-- 服務器上的已經存在的數據庫實例存儲位置 size 10m extent management local autoallocate;-- 創建“學生”表 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;-- 插入數據 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');-- 更新符合條件的數據 update students set classno='0107' where stuname='王小二';-- 刪除符合條件的數據 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);-- 排序統計 select stuname,score from students order by score desc; -- 降序排列-- 創建表的副本 create table students_copy as select* from students select * from students_copy t;-- 刪除表中的數據,表還在 delete students_copy; select * from students_copy t;-- 刪除表的內容和定義,釋放表的空間 drop table students_copy;-- 將students表添加到users表空間中 alter table students move tablespace users;-- 或者在創建表時指定表空間,原則上不同類型的數據對象存放在不同的表空間中 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;-- 用表賦值另一個表,注意字段順序要一致 insert into students_copy select * from students;-- 定義表中的主鍵 alter table students add primary key(stuno);-- 在表創建時就定義主鍵 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;-- 創建排他鎖(整個表只能一個人改),oracle默認也是悲觀的鎖機制——排它鎖 lock table students in exclusive mode;-- 創建行級排他鎖(其他人可以更改表中其他行的數據,但只能查詢另一個人正在修改的行) lock table students in row exclusive mode;-- 查看當前字符集編碼格式,要注意服務器和客戶端的編碼格式一致 -- 參見博客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數據(excel數據保存為csv格式,不要選UTF8格式的,逗號分隔) create table persons -- 創建和excel屬性字段一致的表 (code number(4), name varchar2(20), sex varchar2(4), age number(4) ) tablespace users; select * from persons t;/* persons.ctl內容如下,手動建立,改后綴名為.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,打開命令窗口,輸入以下內容,注意用哪個用戶建立的表就用那個用戶導入數據 sqlldr userid='sys/345@192.168.0.173:1521/test as sysdba' control=D:\land\sql_test\persons.ctl */select * from persons t; -- 查看導入的persons表 -- -------------------------------------------------- ------------------------------------------------ -- 加載txt數據(后綴為.txt,空格隔開) create table persons1 -- 創建和excel屬性字段一致的表 (code number(4), name varchar2(20), sex varchar2(4), age number(4) ) tablespace users; select * from persons1 t;/* persons1.ctl內容如下,手動建立,改后綴名為.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,打開命令窗口,輸入以下內容,注意用哪個用戶建立的表就用那個用戶導入數據 sqlldr userid='sys/345@192.168.0.173:1521/test as sysdba' control=D:\land\sql_test\persons1.ctl*/select * from persons1 t; -- 查看導入的persons表 -- -------------------------------------------------- ------------------------------------------------ -- 直接用ctl文件加載數據 create table persons2 -- 創建和excel屬性字段一致的表 (code number(4), name varchar2(20), sex varchar2(4), age number(4) ) tablespace users; select * from persons2 t;/* persons2.ctl內容如下,手動建立,改后綴名為.ctl load data CHARACTERSET ZHS16GBK infile * append into table persons2 fields terminated by ',' (code,name,sex,age) begindata 1006,張三,女,10 1008,李四,男,15win + r,輸出cmd,打開命令窗口,輸入以下內容,注意用哪個用戶建立的表就用那個用戶導入數據 sqlldr userid='sys/345@192.168.0.173:1521/test as sysdba' control=D:\land\sql_test\persons2.ctl*/select * from persons2 t; -- 查看導入的persons表 -- ----------------------------------------------

(3)中文數據的導入問題
經常會出現亂碼,這是因為編碼問題引起。
首先要查看服務器的編碼格式:

select userenv('language') from dual; 然后根據查詢結果,在客戶端本地系統變量中添加“NLS_Lang”字段,值為查詢的結果,比如“SIMPLIFIED CHINESE_CHINA.ZHS16GBK”。 其次,在所有的導入控制文件中,加入“CHARACTERSET ZHS16GBK”。 最后再導入數據,即可。 注:excel生成的csv文件切記不要保存為UTF-8格式的csv,選另一種未顯式指定編碼類型的。

總結

以上是生活随笔為你收集整理的oracle可视化操作界面——plsql dev安装配置与使用的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。