Oracle資料庫常用SQL

2022-03-12 15:17:58 字數 849 閱讀 9746

oracle資料庫建立例項的過程類似於sql server建立資料庫,oracle乙個例項可以對應多個表空間,乙個表空間對應乙個使用者,根據不同的使用者名稱、密碼登入不同的表空間。

因此,建立表空間後,緊接著要建立使用者並為其指定表空間。並授權給該使用者,一般是connect、resource、dba許可權

grant connect,resource,dba to yun

查詢資料庫名稱:

select name from v$database;

怎樣查得資料庫的sid、系統環境變數

select name from v$database;

建立資料庫時一般要指定sid:

查詢資料庫下的表空間:

select * from dba_tablespaces;

刪除表空間:

drop tablespace test_data including contents and datafiles cascade constraints;

查詢資料庫下的使用者

select * from dba_users;

刪除使用者:

drop user test2 cascade;

cascade : 級聯

建立表:

create table student(id int,name varchar(20))

插入資料:

insert into student values(1,'busan')

修改資料:

update student set name='zhangsan' where id=1

刪除資料:

delete student where id = 2

ORACLE資料庫常用SQL

1.新增乙個表,通過另乙個表的結構和資料 create table product bak as select from product2.如果表存在 insert into product bak select from product 3.同乙個表中,將a欄位的指賦給b欄位 update pro...

Oracle資料庫常用SQL

oracle ora 00984 column not allowed here ora 00984錯誤 列在此處不允許 當資料以char的形式存在時,應加單引號,則插入資料庫就不會出現類似錯誤.oracle實現select的結果集隨機展示 select from tablename order b...

oracle常用資料庫sql語句

建立表空間 create bigfile tablespace 表空間名稱 datafile 表空間路徑 size 100m autoextend on extent management local autoallocate 建立使用者 create user 使用者名稱 identified b...