国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數(shù)據(jù)庫 > Oracle > 正文

ORACLE FOR SUN SOLARIS 維護手冊

2024-08-29 13:39:29
字體:
供稿:網(wǎng)友

  Oracle 的維護工作主要有打開和關(guān)閉數(shù)據(jù)庫;用eXP、imp命令做邏輯備份;用t
  ar命令做物理備份;ORACLE 數(shù)據(jù)庫使用一段時間后的空間擴張和針對具體的工作
  增加臨時或回滾表空間,取消新增的臨時或回滾表空間;增加oracle的用戶,給
  用戶授權(quán)等。以下按順序具體介紹這些維護操作。
  
  一、打開和關(guān)閉數(shù)據(jù)庫
  
  1、打開數(shù)據(jù)庫
  
  ①、#su - oracle
  
  ②、%dbstart
  
  等待十幾秒左右,當看到
  
  oracle instances started,
  
  database mounted,
  
  database opened的時候,oracle數(shù)據(jù)庫打開成功
  
  
  第二步的操作由如下命令組成
  
  %svrmgrl 喚醒SVRMGR狀態(tài)
  
  SVRMGR >connect internal 連接內(nèi)核
  
  SVRMGR>startup 打開數(shù)據(jù)庫
  
  SVRMGR>exit
  
  %
  
  
  備注:打開數(shù)據(jù)庫startup可帶三個參數(shù),分別是
  
  SVRMGR> startup nomount 僅啟動instances
  
  SVRMGR> startup mount 啟動instances,連上(mount)數(shù)據(jù)庫
  
  SVRMGR> startup normal 啟動instances,連上(mount)數(shù)據(jù)庫
  
  打開(open)數(shù)據(jù)庫
  
  startup缺省參數(shù)是normal
  
  ③、 %lsnrctl start 啟動 oracle listener
  
  假如出錯檢查環(huán)境變量是否設(shè)好,及l(fā)snrctl文件的內(nèi)容和執(zhí)行屬性。
  
  2、 關(guān)閉數(shù)據(jù)庫
  
  ①、#su - oracle
  
  ②、%lsnrctl stop 關(guān)閉 oracle listener
  
  ③、%dbshut
  
  等待幾秒左右,當看到
  
  database closed
  
  database dismounted
  
  oracle instances shut down的時候,oracle數(shù)據(jù)庫關(guān)閉成功
  
  第三步的操作由如下命令組成
  
  %svrmgrl 喚醒SVRMGR狀態(tài)
  
  SVRMGR>connect internal 連接內(nèi)核
  
  SVRMGR>shutdown 關(guān)閉數(shù)據(jù)庫
  
  SVRMGR>exit
  
  %
  
  備注:關(guān)閉數(shù)據(jù)庫shutdown可帶三個參數(shù),分別是
  
  SVRMGR> shutdown abort 非正常馬上關(guān)機。等于忽然停電
  
  SVRMGR> shutdown immediate 做回滾操作,馬上關(guān)機。
  
  SVRMGR> shutdown normal 正常關(guān)機
  
  shutdown缺省參數(shù)是normal
  
  二、用exp、imp命令做邏輯備份
  
  1、輸出export
  
  基本命令:一般用交互方式,在oracle用戶提示符下鍵入
  
  % exp user/passWord í
  
  exp 模式
  
  ①、table:export 某個用戶模式下指定的table ;而不是所有的table ,而且不包
  括cluster定義;
  
  ②、user: export一個用戶模式下所有的對象(如表、數(shù)據(jù)、索引等);
  
  export 示例 user mode:
  
  ③、full database: export database 中所有的對象,執(zhí)行這個必須被給
  
  exp-full-database角色。
  
  export 示例
  
  A、dababase mode
  
  % exp system/manager
  
  ... ... ...
  
  enter array fetch buffer size :4096>(return)
  
  export file :expdat.dmp >dba.dmp
  
  e(ntire database),u(sers),t (ables):u>e
  
  export grants (y/n):y>y
  
  export table data (y/n):y>y
  
  compress extents(y/n):y>y
  
  
  B、table mode
  
  % exp system/manager
  
  ... ... ...
  
  enter array fetch buffer size :4096>(return)
  
  export file :expdat.dmp >dba.dmp
  
  e(ntire database),u(sers),t (ables):u>t
  
  export grants (y/n):y>y
  
  export table data (y/n):y>y
  
  compress extents(y/n):y>y
  
  About to exp specified tables ...
  
  Table to be exported (RETURN quit) > emp ( 輸入要輸出的表名 )
  
  .... exporting table EMP 14 rows exported
  
  About to exp specified tables ...
  
  Table to be exported (RETURN quit) > 如此循環(huán)下去,按回車退出
  
  2、輸入import
  
  前提:在database建立之后,必須運行oracle-home /rdbms /admin/catexp.sql
  才能使用export,import。

  
  權(quán)限:要使用 import ,必須要有create session 權(quán)限。假如要import 其它用戶
  的表,必須要有imp_full_databade角色。(運行了catexp.sql后,dba就有了imp
  _full_database角色)。
  
  字符:與export有關(guān),只要兩臺機器的字符設(shè)置一樣就沒問題。
  
  基本命令:一般用交互方式,在oracle用戶提示符下鍵入
  
  % imp user/password
  
  imp 模式
  
  ①、table:答應(yīng)用戶import在用戶模式下指定的table ,而不是所有的table;
  
  ②、user:答應(yīng)用戶import 屬于用戶本身所有的對象;
  
  ③、full database:答應(yīng)用戶import所有的database對象,必須被給予
  
  imp-full-database角色。
  
  import 示例
  
  imp system/manager
  
  ...
  
  import file :expdat.dmp>
  
  enter insert buffer size (minimum is 4096)30720>
  
  export file created by export:v 07.01.03
  
  list contents of import file only(yds /no):no>
  
  ignore create error due to obyict existence (yes /no):yes >
  
  import grants (yes /no):yes>
  
  import table data (yes /no):yes >
  
  import entire export file (yes /no):yes >no
  
  注重事項:
  
  ①、import 的權(quán)限必須大于、等于export的權(quán)限;
  
  ②、 對于long colums 由于對內(nèi)存的非凡要求(需要地址連續(xù)的內(nèi)存區(qū))export
  和 import有時不會成功;
  
  ③、對于備份到磁帶上,export 和import 建議用同一臺磁帶機。
  
  三、用tar命令做物理備份
  
  1、#su - oracle
  
  2、% tar cvf /dev/rmt/0 .
  
  把oracle 路徑下所有文件備份到磁帶機上
  
  3、% tar xvf /dev/rmt/0
  
  把備份磁帶上所有文件恢復進oracle 當前路徑
  
  4、% tar tvf /dev/rmt/0
  
  查看磁帶上有些什么文件
  
  
  四、數(shù)據(jù)庫的擴充
  
  1、增加一個表空間
  
  當我們要開發(fā)某個大型的應(yīng)用程序時,最好建立一個相應(yīng)的表空間。
  
  命令示例:
  
  SVRMGR>create tablespace application datafile
  
  ‘/usr/oracle/dbs/application.dbf’ size 3M
  
  針對具體情況增加回滾和臨時表空間
  
  命令示例:
  
  SVRMGR>create rollback tablespace rbs8 datafile
  
  ‘/usr/oracle/dbs/rbs8.dbf’ size 4M
  
  SVRMGR>create tablespace tmp8 datafile
  
  ‘/usr/oracle/dbs/tmp8.dbf’ size 550K
  
  回滾和臨時表空間用完后,可刪除或使它offline
  
  SVRMGR>drop tablespace rbs8;
  
  SVRMGR>drop tablespaces tmp8;
  
  SVRMGR>alter tablespace rbs offline;
  
  SVRMGR>alter tablespace tmp8 offline;
  
  建立回滾段舉例:
  
  SVRMGR>create rollback segment rs11 tablespace tmp8 ;
  
  SVRMGR>alter rollback segment rs11 online;
  
  SVRMGR>alter rollback segment rs11 offline;
  
  
  2、增加某個表空間的大小
  
  當一個表空間的大小不能滿足工作需要時,應(yīng)該擴充表空間。
  
  舉例:
  
  SVRMGR>alter tablespace system
  
  add datafile ‘/usr/oracle/dbs/sys338.dbf’ size 3M;
  
  五、增加oracle的用戶,并給用戶授權(quán)
  
  1、增加oracle的用戶, 并給用戶授權(quán)
  
  舉例:
  
  SVRMGR>create user newuser identified by userpasswd
  
  default tablespace application
  
  temporary tablespace tmp8;
  
  SVRMGR>grant connect to newuser;
  
  SVRMGR>grant resource to newuser;
  
  SVRMGR>grant update on emp to newuser;
  
  2、增加oracle的角色
  
  oracle的缺省角色有connect、resource、dba。
它是一組可以分配給其它role
  
  或用戶的權(quán)限總和,connect 有8個權(quán)限,resource 有5個權(quán)限,dba有77
  
  個權(quán)限。給一般連接用戶賦connect,給一般編程人員賦connect加resource,
  
  只有數(shù)據(jù)庫治理員才有dba的權(quán)限。
  
  ①創(chuàng)建一個角色
  
  SVRMGR>create role newrole identified by rolepa

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 巴彦淖尔市| 日土县| 股票| 贵定县| 黄浦区| 盐津县| 新蔡县| 芜湖市| 延安市| 平遥县| 竹北市| 开阳县| 安丘市| 东海县| 连州市| 锡林郭勒盟| 衡山县| 五莲县| 黔西| 宿松县| 蒲江县| 台东县| 高要市| 恭城| 南康市| 八宿县| 板桥市| 弥勒县| 宜都市| 封开县| 闸北区| 油尖旺区| 沧源| 两当县| 开远市| 湖南省| 赣榆县| 南靖县| 武穴市| 弥渡县| 高雄县|