Oracle 11g安裝及常用DBA知識及操作

oracle安裝選擇高級安裝,除需手動配置SID外其他均可選默認
sql developer 的啓動錯誤可以通過更新Oracle11g_home1\db_1\jdbc\lib下的那四個文件的方式解決;

sql developer安裝第三方數據庫驅動時先把jar包放在extention下再entry

show user;
alter user scott account unlock;  --給scott解鎖
desc tablename;  --顯示錶結構

--創建新用戶
1-- backup scott
 exp
2-- create user
 create user shijin(username) identified by shijin(password) default tablespace users qutoa(配額) 10M on users
3-- grant
 grant create session,create table,create view to shijin
4-- import the data
 imp(先輸shijin,再輸scott)

--數據字典表 user_tables

desc user_tables;
select table_name from user_tables;
select view_name from user_views;
select constraint_name from user_constraints;
select index_name from user_indexes;

--dictionary表

desc dictionary;

--索引 index

-- 建立主鍵或唯一約束時會自動建立索引;讀起來快,修改起來慢,也會佔用大量空間

create index indexname on tablename (col1name,[col2name]);
create index idx_stu_email on stu (email);

drop index indexname
drop index idx_stu_email;

--序列sequence

--產生一個唯一的不間斷的數字序列;一般用來做主鍵

--首先以SYSREM用戶登錄給shijin用戶授權
grant create sequence to shijin;





create sequence sequencename start with 1 increment by 1;
select sequencename.nextval from dual;
drop sequence sequencename;
create table article(
  id number,
  title varchar2(1024),
  content long,
);

insert into article values (sequencename.nextval,'a','b');
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章