`
nzhzds
  • 浏览: 39962 次
  • 性别: Icon_minigender_1
  • 来自: 苏州
最近访客 更多访客>>
社区版块
存档分类
最新评论

小布老师视频实践

阅读更多
    最近在看小布老师的Oracle培训视频,以下是我跟着做的部分练习,现在整理出来,以备以后查看,不敢独享,就贴出来。当然,因为本人太懒,只要本人觉得看的懂的都没加注解,万望广大网友见谅。

$ lsnrctl start 启动监听

SQL> drop   user SGTEST2 cascade;

SQL> drop tablespace EAS_D_SGTEST2_STANDARD including contents and datafiles;

SQL> SET TIMING ON

SQL> show sga;

SQL> select component, granule_size from v$sga_dynamic_components;

SQL> SELECT sql_text FROM v$sqlarea WHERE executions < 5 ORDER BY UPPER(sql_text);  执行小于5次的SQL语句
SQL> SELECT sql_text,parse_calls,executions FROM v$sqlarea ORDER BY parse_calls;

SQL> startup nomount
SQL> startup mount
SQL> startup open
SQL> alter database mount
SQL> alter database open [read only]

SQL> startup restrict 受限模式
SQL> alter system enable restricted session 受限模式

SQL> create user boobooke identified by bbk; 创建用户boobooke 密码为bbk
SQL> grant connect, resource to boobooke  授权

SQL> alter system set parameter=?

SQL> select sid, serial#, username from v$session;
SQL> alter system kill session 'sid,serial#'; 杀死连接会话

SQL> alter session set SQL_TRACE=true 查看/u01/admin/wilson/udump下的用户*.crc文件

SQL> select username,account_status from dba_users; 查看所有用户及状态
SQL> alter user hr account unlock; 开锁
SQL> alter user hr identified by hr; 重设密码才可用

$ orapwd file=orapwbbk password=123456 entries=10

SQL> create pfile from spfile;
SQL> startup pfile=$ORACLE_HOME/dbs/initwilson.ora

SQL> show parameter control

SQL> select dbid,name from v$database;

控制文件
SQL> ALTER SYSTEM SET control_files =
     '$HOME/ORADATA/u01/ctrl01.ctl',
     '$HOME/ORADATA/u02/ctrl02.ctl' SCOPE=SPFILE;
SQL> shutdown immediate
$ cp $HOME/ORADATA/u01/ctrl01.ctl $HOME/ORADATA/u02/ctrl02.ctl
SQL> startup

SQL> select group#,thread#,sequence#,status from v$log;
SQL> alter system switch logfile;
SQL> alter system checkpoint;

SQL> alter database drop logfile group 3

SQL> col member format a50;
SQL> select * from v$logfile;
SQL> alter database add logfile group 4
  2  ('/u01/oradata/wilson/redo04.log') size 50M; 添加组
SQL> alter database add logfile member
  2  '/u01/oradata/wilson/redo04a.log' to group 4; 往组里加成员
SQL> select * from v$log_history;

SQL> select instance_name, archiver from v$instance; 查看归档模式
SQL> select log_mode from v$database;

SQL> select * from v$tablespace;
SQL> col tablespace_name a10
SQL> select file_name, tablespace_name from dba_data_files;
SQL> create tablespace pual datafile
  2  '/u01/oradata/wilson/paul01.dbf' size 20M; 创建表空间

SQL> desc database_properties;
SQL> select * from database_properties;

SQL> select tablespace_name,contents,extent_management from dba_tablespaces;
SQL> alter database default temporary tablespace mytemp;

SQL> create tablespace wenchuan
  2  datafile '/u01/oradata/wilson/wenchuan01.dbf' size 20M
  3  extent management local uniform size 128k;

SQL> create user dz identified by dz default tablespace wenchuan;
SQL> grant connect,resource to dz;

SQL> alter tablespace wenchuan read only;
SQL> alter tablespace wenchuan read write;

SQL> alter tablespace wenchuan offline;
SQL> alter tablespace wenchuan online;

SQL> alter tablespace wenchuan add datafile
  2  '/u01/oradata/wilson/wenchuan02.dbf' size 20M
  3  autoextend on next 10M maxsize 100M; 新增数据文件让其自动增长
SQL> alter database datafile '/u01/oradata/wilson/wenchuan01.dbf'
  2  autoextend on next 10M maxsize 100M; 改变原文件让其自动增长

ALTER DATABASE
  DATAFILE 'F:\oradata\sgtest2\EAS_D_SGTEST2_STANDARD.ORA'
  AUTOEXTEND ON
  NEXT 50M
  MAXSIZE UNLIMITED;

SQL> select file_name,tablespace_name, autoextensible from dba_data_files; 查看数据文件的autoextend(自动增长)状态

SQL> select file_name,tablespace_name,bytes from dba_data_files;
SQL> alter database datafile '/u01/oradata/wilson/wenchuan01.dbf' resize 40M;

移动数据文件(alter tablespace)
SQL> alter tablespace wenchuan offline;
$ mv wenchuan02.dbf ..
SQL> alter tablespace wenchuan rename datafile '/u01/oradata/wilson/wenchuan02.dbf'
  2  to '/u01/oradata/wenchuan02.dbf';
SQL> alter tablespace wenchuan online;

移动数据文件(alter database)
SQL> shutdown immediate
$ mv wenchuan02.dbf wilson/
SQL> startup mount
SQL> alter database rename file '/u01/oradata/wenchuan02.dbf'
  2  to '/u01/oradata/wilson/wenchuan02.dbf';
SQL> alter database open;

SQL> create tablespace wenchuan
  2  datafile '/u01/oradata/wilson/wenchuan01.dbf' size 20M
  3  extent management local uniform size 128k
  4  segment space management auto;

$ cd [ORACLE_HOME]/rdbms/admin
Log into SQL*Plus as SYSTEM
SQL> @utlxplan
SQL> GREATE PUBLIC SYNONYM PLAN_TABLE FOR PLAN_TABLE;
SQL> GRANT ALL ON PLAN_TABLE TO PUBLIC;
SQL> quit
$ cd [ORACLE_HOME]/sqlplus/admin
Log into SQL*Plus as SYS or as SYSDBA
SQL> @plustrce
SQL> GRANT PLUSTRACE TO PUBLIC;
特定用户登录
SQL> set autot on stat
SQL> select count(*) from tb;
SQL> begin
  2  for i in 1 .. 1000000
  3  loop
  4 insert into tb values(i, 'boobooke');
  5  end loop
  6  ;
  7  commit;
  8  end;
  9  /

SQL> select max(undoblks / ((end_time - begin_time)*24*3600)) from v$undostat; 每秒需要最多的undo数据块

SQL> show user;
USER ? "SYS"
SQL> create tablespace assm datafile
  2  '/u01/oradata/wilson/assm_1.dbf' size 100M
  3  extent management local uniform size 128k  
  4  segment space management auto;
SQL> create tablespace mssm datafile
  2  '/u01/oradata/wilson/mssm_1.dbf' size 100M
  3  extent management local uniform size 128k
  4  segment space management manual;
SQL> create user as1 identified by as1 default tablespace assm;
SQL> create user ms1 identified by ms1 default tablespace mssm;
SQL> grant connect, resource to as1;
SQL> grant connect, resource to ms1;

SQL> create global temporary table tmp_session on commit preserve rows
  2  as select * from t where 1=0; 创建会话临时表
SQL> create global temporary table tmp_transaction on commit delete rows
  2  as select * from t where 1=0; 创建事务临时表
SQL> insert into tmp_session select * from t;
SQL> insert into tmp_transaction select * from t;

SQL> alter table hr.employees
  2  pctfree 30
  3  pctused 50
  4  storage (next 500k minextents 2 maxextents 100);

SQL> alter table hr.employees
  2  move tablespace data1;

SQL> select dbms_metadata.get_ddl('TABLE','T') from dual; 查看完整的表结构

SQL> alter table t   
  2  set unused column name;

SQL> alter table orders allocate extent;

SQL> create index hr.employees_last_name_idx
  2  on hr.employess(last_name)
  3  pctfree 30
  4  storage(initial 200k next 200k pctincrease 0 maxextents 50)
  5  tablespace indx;

SQL> create bitmap index my_bit_indx on t(sex); 创建位图索引

SQL> alter index order_region_id_idx rebuild
  2  tablespace indx02;

SQL> alter index my_bit_indx rebuild online; 联机重建索引

SQL> alter index my_bit_indx coalesce; 整理索引碎片

SQL> analyze index my_bit_indx validate structure; analyze index my_bit_indx validate structure offline;
SQL> select height,name,lf_rows,lf_blks,del_lf_rows from index_stats;

查看索引有没有被使用
SQL> alter index my_bit_indx monitoring usage;
SQL> select * from v$object_usage;
SQL> set autot on exp
SQL> set autot off
SQL> alter index my_bit_indx nomonitoring usage;

SQL> alter table t modify id not null;

SQL> alter table bonus
  2  add constraint uq_emp_id unique(dept, emp_id)
  3  using index tablespace indx
  4  storage (initial 32k next 32k pctincrease 0);

SQL> select constraint_name, status, validated from user_constraints; (1,54节)

SQL> alter table t add primary key(id) deferrable;
SQL> alter table t disable primary key;
SQL> insert into t values(0, 'boobooke');
SQL> insert into t values(0, 'boobooke');
SQL> alter table t enable novalidate primary key; / alter table t enable novalidate constraint t_pk;
/ alter table t enable validate constraint t_pk;
SQL> set constraints all deferred;

SQL> @?/rdbms/admin/utlexpt1.sql
SQL> alter table t enable validate primary key exceptions into exceptions;
SQL> select rowid, id, name from t where rowid in (select row_id from exceptions);

SQL> @?/rdbms/admin/utlpwdmg 密码管理 (1,56节)

SQL> select * from session_privs; 查看本用户权限

SQL> create user u1 identified by u1 default tablespace mytbs quota unlimited on mytbs;

SQL> revoke create table from emi;

SQL> select * from session_roles;
SQL> select * from role_role_privs;
SQL> select * from role_sys_privs;
SQL> select * from role_tab_privs;

SQL> alter system set audit_trail=db scope=spfile;
SQL> shutdown immediate
SQL> startup
SQL> audit session by boobooke;
SQL> select username, timestamp, action_name from dba_audit_trail;
SQL> noaudit session by boobooke;

SQL> alter table emp nologging;
SQL> insert /*+ APPEND */ into emp
  2  select * from t_employees;
SQL> commit;

SQL> create table emp
  2  (empno int,
  3   ename varchar2(20)
  4  )
  5  partition by hash(empno)
  6  (partition part1,
  7   partition part2
  8  )
  9  /
SQL> alter session enable parallel dml;
SQL> insert /*+ PARALLEL(hr.emp,2) */
  2  into hr.employees
  3  select * from hr.old_employees;
SQL> commit;

SQL> select * from nls_database_parameters; 查询字符集

SQL> show parameter nls_length_sematic       

SQL> select id, dump(name, 1016) from tb;

SQL> ALTER SESSION SET NLS_LANGUAGE=Italian;

C:\> set NLS_LANG=American_America.ZHS16GBK

$ export NLS_LANG=American_America.ZHS16GBK

SQL> select * from nls_session_parameters;

SQL> select * from v$nls_valid_values;

C:\>tnsping WILSON 10

SQL> alter system set dispatchers='(PROTOCOL=TCP) (dispatchers=4) (SERVICE=wilson)';

SQL> select circuit,dispatcher,server,status,queue from v$circuit;

$ cat /dev/null > alert_wilson.log    清空文件

归档模式
把数据库改为归档日志模式
SQL> shutdown normal/immediate/transtractions
SQL> startup mount
SQL> alter database archivelog/noarchivelog;
SQL> alter database open;
SQL> shutdown immediate
到oradata下做全备

system set log_archive_start=true scope=spfile;

SQL> alter system set log_archive_max_processes=2;


SQL> show parameter log_archive_start
SQL> alter system archive log start to '/oradata/archive1';

SQL> archive log list

SQL> alter system archive log stop;

SQL> alter system archive log current; 手动归档

SQL> alter system set log_archive_dest_1="location=/u01/admin/wilson/archive" scope=both;
SQL> alter system set log_archive_format="wilson%t_%S_%r.arc" scope=spfile;
SQL> alter system switch logfile;

备份
SQL> select name, status from v$datafile;
SQL> select name from v$controlfile;
SQL> select member from v$logfile;
SQL> SELECT t.name tablespace, f.name datafile
  2  FROM v$tablespace t, v$datafile f
  3  WHERE t.ts# = f.ts#
  4  ORDER BY t.name; 查询表空间里有哪些数据文件

热备  bbk4020
SQL> select file_name, tablespace_name from dba_data_files;
SQL> alter tablespace example begin backup;
SQL> !cp /u01/oradata/wilson/example01.dbf /tmp/hb
SQL> alter tablespace example end backup;
SQL> alter system archive log current;
SQL> alter system switch logfile; 可多做几次

SQL> select dbms_rowid.rowid_block_number(rowid) blk, name fruit; //1012
$ dd if=example01.dbf ibs=8192 skip=1011 count-2 | strings

SQL> select * from v$backup;              bbk4020    p298
SQL> alter database [datafile 5] end backup; 备份时突然断电,再启动时处于mounted状态使用,中括号里可有可无
SQL> alter database open;
bbk4021
SQL> alter tablespace example read only;
SQL> alter tablespace example read write;

SQL> alter database backup controlfile to '/tmp/con/c1.ctl'; p303

SQL> alter database backup controlfile to trace as '/tmp/con/c2.sql';

sys_dba_segs             utilis
$ dbv file=system01.dbf feedback=100    p306

pbbk4022
$ rman target sys/123456@WILSON nocatalog      /    $ rman target / nocatalog
RMAN> show all;
RMAN> configure default device type to sbt;
RMAN> configure default device type clear;
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/backup/ctl_%F';f
RMAN> list backup of database;
RMAN> list backup of datafile '/u01/oradata/wilson/system01.dbf';
RMAN> list copy of tablespace 'USERS';
RMAN> list backup of tablespace 'USERS';

pbbk4023
RMAN> report schema;
RMAN> backup datafile 4,5 format '/u01/backup/md_%U';

RMAN> backup datafile '/u01/oradata/wilson/users01.dbf' format '/u01/backup/df_%U';

RMAN> list backup;
RMAN> delete backupset 1,2;

RMAN> backup database [format '/u01/backup/md_%U'];  pbbk4023

RMAN> backup tablespace USERS,EXAMPLE format '/u01/backup/ts_%U';   pbbk4024

RMAN> backup current controlfile;

RMAN> backup datafile 4 include current controlfile [format '...'];

RMAN> sql "alter database backup controlfile to ''/u01/backup/ctl_20100515.ctl''";

RMAN> backup spfile format '/u01/backup/sp_%U';

RMAN> backup archivelog all format '/u01/backup/ac_%U' delete all input;
RMAN> backup archivelog sequence between 99 and 199 thread 1 delete input;
RMAN> backup archivelog from time "sysdate-15" until time "sysdate-7";

pbbk4025
RMAN> backup database plus archivelog format '/u01/backup/db_%U';

RMAN> run {
2>      allocate channel d1 device type disk maxpiecesize=100M;
3>      backup database filesperset 3;
4> }

RMAN> run{
2>      allocate channel c1 type disk;
3>      allocate channel c2 type disk;
4>      allocate channel c3 type disk;
5>      backup incremental level=0
6>      format '/u01/backup/p_%U'
7>      (datafile 5 channel c1 tag='example')
8>      (datafile 7 channel c2 tag='assm')
9>      (datafile 4,6 channel c3 tag='other');
10>     sql 'alter system archive log current';
11> }

RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 3 BACKUP TYPE TO BACKUPSET; 设置并发度为3

RMAN> backup copies 2 datafile 5 format '/u01/b1/d_%U','/u01/b2/d_%U';

RMAN> copy datafile 5 to '/u01/backup/example20101515.dbf' tag='example';

RMAN> list copy;

RMAN> backup as copy datafile 5 format '/u01/backup/example20101515.dbf';

pbbk4026
RMAN> run {
2>      allocate channel d1 type disk;
3>      backup incremental level 0 database format '/u01/backup/10_%U';
4> }

select sid, sofar, totalwork from v$session_longops;
--差异增量
RMAN> run {
2>      allocate channel d1 type disk;
3>      backup incremental level 1 database format '/u01/backup/l1_%U';
4> }
--累积增量
RMAN> run {
2>      allocate channel d1 type disk;
3>      backup incremental level 1 cumulative database format '/u01/backup/lc1_%U';
4> }

pbbk4027
SQL> alter database enable block change tracking using file
  2  '/u01/track.bin'; 10g以上可用
SQL> alter database disable block change tracking;

RMAN> backup incremental level 2 datafile 4 tag='wilsonram';
RMAN> list backup tag='wilsonram';


添加磁盘 bbk4029
# cd /dev
[root@xia dev]# fdisk sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): p

Disk sdb: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-522, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-522, default 522):
Using default value 522

Command (m for help): p

Disk sdb: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System
  sdb1               1         522     4192933+  83  Linux

Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@xia dev]# mkfs.ext3 sdb1
[root@xia ~]# mkdir md
[root@xia ~]# mount /dev/sdb1 md        (要自动挂载可修改/etc/fstab)

SQL> conn / as sysdba
Connected to an idle instance.
SQL> create pfile from spfile;
SQL> startup mount
SQL> select file#,name from v$datafile;
SQL> alter database rename file '/u01/oradata/wilson/system01.dbf' to 'xxx/system01.dbf';
SQL> select file#,name from v$tempfile;
SQL> select group#,member from v$logfile;
SQL> alter database open;

生成联机重做日志文件  p368
SQL> startup mount
SQL> recover database until cancel using backup controlfile;
cancel
SQL> alter database open resetlogs;

bbk4071
SQL> select * from v$recover_file;
no rows selected    说明数据库正常,没有文件损坏,不需要恢复

手工完全恢复 bbk4072
SQL> create tablespace app1 datafile '/u01/oradata/wilson/app1_01.dbf' size 100M
  2  extent management local uniform segment space management auto;
SQL> select file#,ts#,name from v$datafile;
SQL> create user user1 identified by user1# default tablespace app1;
SQL> grant connect, resource to user1;
SQL> conn user1/user1#
SQL> shutdown immediate

SQL> set autorecovery off
SQL> recover datafile 1;
SQL> alter database open;

bbk4092      p395
SQL> select file#,checkpoint_change# from v$datafile;  从控制文件读
SQL> select file#,checkpoint_change# from v$datafile_header;  从数据文件头读

bbk4092
恢复控制文件
SQL> alter database backup controlfile to '/u01/ubackup/ctl.bin';

Database altered.

SQL> shutdown abort
ORACLE instance shut down.
$ cp /u01/ubackup/ctl.bin /u01/oradata/ORCL/controlfile/o1_mf_66f5g4on_.ctl
SQL> startup
ORACLE instance started.

Total System Global Area  285212672 bytes
Fixed Size                  1267044 bytes
Variable Size             100666012 bytes
Database Buffers          176160768 bytes
Redo Buffers                7118848 bytes
Database mounted.
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open      bbk4092


SQL> recover database using backup controlfile;
ORA-00279: change 709886 generated at 02/06/2011 21:22:28 needed for thread 1
ORA-00289: suggestion : /u01/achive/1_14_742408353.dbf
ORA-00280: change 709886 for thread 1 is in sequence #14


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/u01/oradata/ORCL/onlinelog/o1_mf_1_6nwq51d5_.log
ORA-00310: archived log contains sequence 13; sequence 14 required
ORA-00334: archived log: '/u01/oradata/ORCL/onlinelog/o1_mf_1_6nwq51d5_.log'


SQL> recover database using backup controlfile;
ORA-00279: change 709886 generated at 02/06/2011 21:22:28 needed for thread 1
ORA-00289: suggestion : /u01/achive/1_14_742408353.dbf
ORA-00280: change 709886 for thread 1 is in sequence #14


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/u01/oradata/ORCL/onlinelog/o1_mf_2_6nwq5572_.log
ORA-00283: recovery session canceled due to errors
ORA-01244: unnamed datafile(s) added to control file by media recovery
ORA-01110: data file 8: '/u01/oradata/ORCL/datafile/app3_01.dbf'


ORA-01112: media recovery not started


SQL> recover database using backup controlfile;
ORA-00283: recovery session canceled due to errors
ORA-01111: name for data file 8 is unknown - rename to correct file
ORA-01110: data file 8: '/u01/oracle/dbs/UNNAMED00008'
ORA-01157: cannot identify/lock data file 8 - see DBWR trace file
ORA-01111: name for data file 8 is unknown - rename to correct file
ORA-01110: data file 8: '/u01/oracle/dbs/UNNAMED00008'


SQL> col error for a18
SQL> select * from v$recover_file;

     FILE# ONLINE  ONLINE_ ERROR                 CHANGE# TIME
---------- ------- ------- ------------------ ---------- ------------
         8 ONLINE  ONLINE  FILE MISSING                0

SQL> col name format a50
SQL> select file#,name from v$datafile;

     FILE# NAME
---------- --------------------------------------------------
         1 /u01/oradata/ORCL/datafile/o1_mf_system_66f5cpnh_.
           dbf

         2 /u01/oradata/ORCL/datafile/o1_mf_undotbs1_66f5cpv6
           _.dbf

         3 /u01/oradata/ORCL/datafile/o1_mf_sysaux_66f5cpo1_.
           dbf

         4 /u01/oradata/ORCL/datafile/o1_mf_users_66f5cpx9_.d
           bf

     FILE# NAME
---------- --------------------------------------------------

         5 /u01/oradata/ORCL/datafile/perfstat_01.dbf
         6 /u01/oradata/ORCL/datafile/app1_01.dbf
         7 /u01/oradata/ORCL/datafile/app02_01.dbf
         8 /u01/oracle/dbs/UNNAMED00008

8 rows selected.
SQL> alter database rename file '/u01/oracle/dbs/UNNAMED00008' to '/u01/oradata/ORCL/datafile/app3_01.dbf';

Database altered.

SQL> select file#,name from v$datafile;

     FILE# NAME
---------- --------------------------------------------------
         1 /u01/oradata/ORCL/datafile/o1_mf_system_66f5cpnh_.
           dbf

         2 /u01/oradata/ORCL/datafile/o1_mf_undotbs1_66f5cpv6
           _.dbf

         3 /u01/oradata/ORCL/datafile/o1_mf_sysaux_66f5cpo1_.
           dbf

         4 /u01/oradata/ORCL/datafile/o1_mf_users_66f5cpx9_.d
           bf

     FILE# NAME
---------- --------------------------------------------------

         5 /u01/oradata/ORCL/datafile/perfstat_01.dbf
         6 /u01/oradata/ORCL/datafile/app1_01.dbf
         7 /u01/oradata/ORCL/datafile/app02_01.dbf
         8 /u01/oradata/ORCL/datafile/app3_01.dbf

8 rows selected.

SQL> recover database using backup controlfile until cancel;      bbk4092
ORA-00279: change 711258 generated at 02/06/2011 21:51:50 needed for thread 1
ORA-00289: suggestion : /u01/achive/1_14_742408353.dbf
ORA-00280: change 711258 for thread 1 is in sequence #14


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/u01/oradata/ORCL/onlinelog/o1_mf_1_6nwq51d5_.log
ORA-00310: archived log contains sequence 13; sequence 14 required
ORA-00334: archived log: '/u01/oradata/ORCL/onlinelog/o1_mf_1_6nwq51d5_.log'


ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/u01/oradata/ORCL/datafile/o1_mf_system_66f5cpnh_.dbf'
SQL> recover database using backup controlfile until cancel;
ORA-00279: change 711258 generated at 02/06/2011 21:51:50 needed for thread 1
ORA-00289: suggestion : /u01/achive/1_14_742408353.dbf
ORA-00280: change 711258 for thread 1 is in sequence #14


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/u01/oradata/ORCL/onlinelog/o1_mf_2_6nwq5572_.log
Log applied.
Media recovery complete.

SQL> alter database open resetlogs;

Database altered.

RMAN恢复 bbk4098
C:/> rman target xxx/xxxx@ip:prot/sid
RMAN> list backup;
RMAN> backup database format '/u01/backup/wb_%U';
RMAN> sql 'alter system archive log current';

p410
RMAN>  run{
set newname for datafile 1 to '/<newdir>/system01.dbf';
restore database;
switch datafile all;
recover database;
alter database open; }

p412
RMAN> run{
sql “alter database datafile 6 offline immediate”;
restore datafile 6;
recover datafile 6;
sql “alter database datafile 6 online”;
}

bbk4314   p421
SQL> recover database using backup controlfile until cancel;

bbk4320   p453
RMAN> RUN {
ALLOCATE CHANNEL c1 TYPE DISK;
ALLOCATE CHANNEL c2 TYPE DISK;
SET UNTIL TIME "to_date('2010-05-19:09:20:42','YYYY-MM-DD:HH24:MI:SS')";
RESTORE DATABASE;
RECOVER DATABASE;
ALTER DATABASE OPEN RESETLOGS; }

to_date('2010-05-19:09:20:42','YYYY-MM-DD:HH24:MI:SS')

bbk4444
导入导出
SQL> grant exp_full_database,imp_full_database to user;

bbk4445
c:\> chcp
SQL> select * from nls_database_parameters;
c:\> SET NLS_LANG=American_America.AL32UTF8 (NLS_LANGUAGE _ NLS_TERRITORY .NLS_CHARACTERSET)
c:\> exp user/passwd parfile=p.txt

c:\> imp user/passwd show=y file=XXX.dmp

bbk4446
c:\> exp user/passwd parfile=p.txt direct=y   直接导出较快,buffer不起作用

锁定SGA不换页
SQL> alter system set lock_sga=true scope=spfile;

c:\>lsnrctl
LSNRCTL> help
分享到:
评论

相关推荐

    小布老师oracle视频下载

    从给定的文件信息来看,这是一系列关于Oracle 9i DBA Fundamentals I的教程视频,由小布老师提供。这些视频被分成了多个部分,每个部分包含了一个rar压缩包,通过ed2k链接进行下载。下面,我们将对Oracle 9i DBA ...

    小布老师Oracle9iDBA视频教程

    教程名称:小布老师Oracle 9i DBA视频教程课程目录:【】DBA视频教程1-3章【】DBA视频教程11-13章【】DBA视频教程14-18章【】DBA视频教程19-20章【】DBA视频教程4-7章【】DBA视频教程8-10章 资源太大,传百度网盘了...

    小布老师oracle第一集

    【Oracle数据库基础概念】 Oracle,由甲骨文公司(Oracle Corporation)开发的数据库...对于初学者来说,这是掌握Oracle数据库管理和开发的第一步,通过小布老师的讲解,将有助于构建坚实的Oracle理论基础和实践技能。

    小布老师oracle教学总结

    小布老师Oracle.9i.DBA.Fundamentals1教学总结

    小布老师的loadrunner视频网址

    【小布老师的LoadRunner视频网址】提供了针对初学者的LoadRunner性能测试工具的学习资源,适合对性能测试感兴趣的人员。LoadRunner是一款由Micro Focus公司开发的负载和性能测试工具,广泛应用于企业级应用系统的...

    小布老师oracle材料,第二部分

    小布老师oracle材料,第一部分小布老师oracle材料,第一部分 小布老师oracle材料,第二部分 小布老师oracle材料,第二部分

    小布老师RAC实验图文指导文章

    小布老师的RAC实验图文指导文章旨在帮助学习者掌握如何在Oracle Linux 4 (OEL) 上安装和配置Oracle 10g RAC环境。下面是对这个实验中涉及的关键知识点的详细解释。 1. **Oracle Real Application Clusters (RAC)**:...

    小布老师 oracle rac 安装文档

    小布老师的Oracle RAC安装文档详细介绍了如何在多台服务器上配置和安装这一复杂系统。以下是对Oracle RAC安装过程的一些关键知识点的详细说明: 1. **Oracle RAC的基本概念**: - Oracle RAC是一种集群数据库解决...

    小布老师Oracle9i DBA Fundamentals II 视频教程学习笔记

    《小布老师Oracle9i DBA Fundamentals II 视频教程学习笔记》是针对Oracle数据库管理基础II课程的深入解析,由知名教育平台聚众培训视频网提供,旨在帮助学员掌握Oracle9i环境下数据库管理的核心技能。以下是该教程...

    小布老师Oracle.9i.DBA.Fundamentals.10-13

    通过小布老师的讲解,学习者不仅可以深入了解Oracle 9i DBA的基础知识,还能获得实践操作的经验,为后续的进阶学习和实际工作打下坚实的基础。在学习过程中,建议结合实际的数据库环境进行操作练习,以加深理解和...

    小布老师SQL学习笔记

    《小布老师SQL学习笔记》 SQL,全称为Structured Query Language,即结构化查询语言,是用于管理和处理数据库的标准语言。在Oracle 11g SQL Fundamentals Training中,我们主要探讨了SQL的基础知识,包括如何使用...

    小布老师:vi 使用入门

    小布老师 vi Unix/Linux boobooke

    小布老师 Oracle9i DBAFundamentals I 视频教程学习笔记

    通过小布老师的《Oracle9i DBA Fundamentals I》视频教程学习笔记,我们不仅能够深入了解Oracle9i数据库的架构和工作原理,还能掌握数据库管理和优化的关键技术,对于提升Oracle数据库的性能和稳定性具有重要的实践...

    RAC-小布老师rac部署文档图解

    在"RAC-小布老师rac部署文档图解"中,我们将深入探讨RAC的核心概念、工作原理以及部署过程。 一、RAC核心概念 1. **多实例共享存储**:RAC中的每个节点都运行一个数据库实例,所有实例共享同一份物理数据库。当...

    小布oracle性能调优目录

    小布oracle性能调优目录小布oracle性能调优目录小布oracle性能调优目录

    小布Oracle11gSQL基础入门培训视频教程(30集)

    教程名称:小布Oracle 11g SQL基础入门培训视频教程(30集)课程目录:【】oracle 11g sql 基础入门系列培训(1)【】oracle 11g sql 基础入门系列培训(2)【】oracle 11g sql 基础入门系列培训(3)【】oracle 11g ...

    小布老师oracle教案PPT_2

    根据给定文件的信息,我们可以提炼出以下关于小布老师Oracle 9i DBA Fundamentals II 视频教程的学习笔记中的关键知识点。 ### 一、Oracle 9i 网络环境概览 #### 1. 网络环境挑战 - **配置网络环境**:涉及网络...

    小布老师oracle第2集

    "小布老师Oracle第2集"可能是指一系列Oracle数据库学习教程的第二部分,由"小布老师"主讲,旨在帮助学习者深入理解Oracle的相关概念和技术。 在Oracle数据库的学习中,有几个核心知识点是非常重要的: 1. **数据...

    小布老师Oracle.9i.DBA.Fundamentals.05-09

    《小布老师Oracle.9i.DBA.Fundamentals.05-09》是一套针对Oracle数据库管理基础的教程,由知名IT教育家小布老师主讲。这套课程共有76集,涵盖从第五集到第九集的内容,是学习Oracle数据库管理员(DBA)基础知识的理想...

Global site tag (gtag.js) - Google Analytics