文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>oracle ocp笔记(1)

oracle ocp笔记(1)

时间:2010-09-24  来源:Brad Miller

startup force;   重启数据库
shutdown;        关闭数据库
shutdown abort;  例程已经关闭

startup mount ; 例程已经启动    mount启动后动态试图就可以查看了
alter database open ;  打开数据库


alter system switch logfile;  切换logfile


EXECUTE DBMS_LOGMNR_D.BUILD('merrydict.ora','C:\redo');

EXECUTE dbms_logmnr.start_logmnr(DICTFILENAME=>'c:\redo\REDO03.LOG')


alter tablespace APTS online;
alter tablespace APTS offline;
alter tablespace APTS read only;
alter tablespace APTS rename datafile  

drop tablespace APTS oncluding contents;  注销表空间
alter tablespace APTS add datafle '' size 200M autoextend on next 10M maxsiza 500M;

alter tabl resize

alter tablespace APTS rename datafile '' to '';
alter database rename file '' to '';

dba_tablespaces
v$tablespace

pctfree  =20%  空余空间定义
pctused  =40%  使用空间底线

第5课    41分钟 从第10章跳到了第12章

第6课
13章
disable        enable    约束是否启用
novalidate     validate  约束是否检查已有数据
alter table tt.rightcert enable validate constraint rightcert_certid_pk;  锁定表,数据必须满足约束,
exceptions 子句

第7课
14章  load data
export inport
direct-load inserts  直接路径插入
exp:
insert /*+APPEND */ into scott.emp nologging
 select * from scott.old_emp;
 nologging表示不写redo日志,/*+APPEND */是一个提示,提示系统将数据插入在高水点之后(高水点是连续空间,这样可以提高插入速度)
create table tt1 as select empno,ename ,sal from emp where 1=2; 

alter session enable parallel DML;
insert /*+parallel(scott.emp,2) */ into scott.emp nologging select * from scott.old_emp;  并行插入,起用2个并行进程

sql*loader   作用:将少量文本型数据加载到数据库中
   Conventional Load 普通路径的加载,转换为insert,需要commit进行提交,记redo日志,对所有约束有效,可以触发trigger,使用clustered tables,不锁定tables。
   Direct Path Load  直接路径的加载,使用data saves技术(直接将数据文件迁移到数据库的数据文件中),不需要commit进行提交,不记redo日志,只支持所主键、唯一键和not null约束,不触发trigger,不能使用clustered tables,锁定tables。
exp:
sqlldr scott/tiger control=ulcase6.ctl log=ulcase6.log direct=true;  ulcase6.ctl是控制文件,需要手工编写,大体如下:
    load data
    infile 'ulcase6.dat'
    insert into table emp
     (empno position(01:04) integer external nullif empno=blanks,...)
  bindsize  普通路径的加载时数组的大小设置。
控制文件举例:
    load data
    infile *
    insert into table scott.dept 
     fields terminated by ',' optionally enclosed by '"'
     (deptno,dname,loc)
    begindata
     10,account,new york
     20,research,dallas
     30,sales,chigago


15章 reorganize tables 重组数据
export import
导出表  (table data index trigger constraints Grants AnalyzeMethod)
exp scott/tiger@orcl tables=(dept,emp) file=c:\emp.dmp log=c:\exp.log compress=n direct=y
compress 压缩
direct   直接导出

imp scott/tiger tables=(dept,emp) file=emp.dmp log=exp.log ignore=y
ignore  忽略错误
导入顺序 table-->data-->B-tree indexes-->constraints,triggers,bitmap,indexes  相同表空间『默认表空间』

consistent=y  在回滚段中镜像所有导出表 (保持了一致性,只能用于小表),默认consistent=n
compress=y    可以使用在连续的,没有删除操作的表上,能够提高速度。对于被删除的行,compress=y 时则被导出,从而不能重组数据,所以默认>compress=n

导入导出字符集的问题:
   1.导入导出字符集一致即可;2.如果不一致,默认低字节向高字节转换。oracle自带有7位单字节、8位单字节、16位双字节、24位三字节字符集。

可传输表空间:
 1.使表空间只读 alter tablespace sales_ts read only
        2.将表空间的定义信息导成操作系统文件      exp sys/... file=xxx.dmp transport_tablespace=y tablespaces=sales_ts triggers=n constraints=n
 3.将表空间的数据文件拷贝到目标机器
 4.将表空间的定义信息文件拷贝到目标机器     (导入导出的路径要求是全路径)
 5.将表空间的定义信息文件导入到目标数据库  imp sys/... file=xxx.dmp transport_tablespace=y datafiles=(/disk1/sales01.dbf,/disk2/sales02.dbf)
        6.将表空设置为可读写 alter tablespace sales_ts read write
 7.限制:相同的操作系统,oracle的版本在8i以上,数据块大小一致(8192),相同的字符集,表空间中的对象必须全部属于本表空间(自包含),嵌套表、位图索引不能被导出
          验证自包含的方法: exec DBMS_TTS.TRANSPORT_SET_CHECK(ts_list =>'sales_ts',incl_constraints=>TRUE);

16章 数据库安全
     表空间限(配)额
     缺省表空间
     排序表空间的使用
     账号锁定        account locking
     资源的限制
     直接权限
     角色权限 role
     操作系统验证数据库验证
 参数:failed_login_attempts  密码尝试登陆次数的设定
              password_lock_time     密码锁定的天数
              password_life_time     密码生命期(天数)
              password_grace_time    优雅时间:密码过期后,用户第一次登陆后,修改密码的时间
              password_reuse_time    密码重用间隔天数
       password_reuse_max     密码重用次数
              password_verify_function  密码校验函数
  密码管理:
     alter user hanne identified by rue account lock; 给用户加锁解锁
     alter user hanne identified by rue account unlock;

第9课  直接跳到了18章


20章 (11课 36分) 字符集与国际语言字符集
单字节 7-bit,8-bit
双字节 16-bit
三字节 24-bit
unicode (utf8,al24utffss)
字符集的定义层次:
   会话层         session(级别最高)
   环境变量       nls_lang=<language>_<territory>.<charset>   charset 字符集  SIMPLIFIED CHINESE_CHINA.ZHS16GBK
   初始化参数
   nls_language 
   nls_date_language
   nls_sort
   nls_territory      
   nls_currency        $
   nls_iso_currency  
   nls_date_format     yyyy-mm-dd
   nls_numeric_characters

 create database ... character set <charset> national character set <ncharset> ... 创建数据库时设置字符集
        alter session set nls_date_format='yyyy-mm-dd';      设置会话的日期格式
        dbms_session.set_nls('nls_date_format',"'yyyy-mm-dd'");
        alter session set nls_sort=Eanglish;   设置按什么语言排序

12课 9分钟    开始讲 sql

17课  12分钟  开始讲 oracle网络知识  (2天 10章)

21课  oem 备份与恢复
      备份策略:商务需求,硬件环境
      fast_start_io_target=10000            系统崩溃后,下次启动后要读写多少个块,设大恢复慢,设小影响速度。

     影响checkpoint的因素:
        达到 fast_start_io_target设定的数据块
        达到最小的redo log 的90%
        log_checkpoint_timeout
        log_checkpoint_interval blocks

    archived 归档
        归档到本地磁盘
        归档到远程数据库(standby site)
   各种类型的失败:
       语句类型的失败(语法错误)
       用户进程失败()
       用户可能的错误操作(用户错误删除表中数据)
       instance失败 (系统自动恢复操作)
       媒体(物理介质)的失败

   fast_start_parallel_rollback 并行回滚

归档模式 archivelog
    log_archive_start 是否启用归档; log_archive_dest_n 归档的目录(n是归档路径的路径个数,即支持多路径归档);  log_archive_format 归档文件的名字;


scott/tiger 下的emp表的创建语句
create table EMP
(
  EMPNO    NUMBER(4) not null,
  ENAME    VARCHAR2(10),
  JOB      VARCHAR2(9),
  MGR      NUMBER(4),
  HIREDATE DATE,
  SAL      NUMBER(7,2),
  COMM     NUMBER(7,2),
  DEPTNO   NUMBER(2)
)
tablespace SYSTEM
  pctfree 10
  pctused 40
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
-- Create/Recreate primary, unique and foreign key constraints
alter table EMP
  add constraint PK_EMP primary key (EMPNO)
  using index
  tablespace SYSTEM
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
alter table EMP
  add constraint FK_DEPTNO foreign key (DEPTNO)
  references DEPT (DEPTNO);

 

相关阅读 更多 +
排行榜 更多 +
毒药轮盘手机版下载

毒药轮盘手机版下载

休闲益智 下载
剑侠情缘零b服手游下载

剑侠情缘零b服手游下载

角色扮演 下载
惊魂动物园游戏手机版下载

惊魂动物园游戏手机版下载

冒险解谜 下载