全部博文(101)
分类: Oracle
2011-12-25 22:30:30
1. windows环境
笔记本上的硬件环境;
操作系统:windows xp 32位
数据库实例名:orcl2
用户名/密码:orcl2/orcl2
IP地址:192.168.2.3
2. linux环境
笔记本上的虚拟机系统;
操作系统:redhat linux 5 32位
数据库实例名:orcl
用户名/密码:scott/tiger
IP地址:192.168.2.5
3. windows上面的数据库作为恢复目录,linux上的数据库作为目标数据库;
4.在linux系统上,用控制文件的方式来rman操作脚本如下;
[oracle@localhost ~]$ ifconfig
bash: ifconfig: command not found
[oracle@localhost ~]$ lsnrctl status
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 26-DEC-2011 15:37:35
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost.jacky)(PORT=1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
[oracle@localhost ~]$ lsnrctl start
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 26-DEC-2011 15:37:43
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.jacky)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 26-DEC-2011 15:37:45
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.jacky)(PORT=1521)))
Services Summary...
Service "PL***tProc" has 1 instance(s).
Instance "PL***tProc", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).
Instance "ORCL", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@localhost ~]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Dec 26 15:38:09 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> conn / as sysdba
Connected to an idle instance.
SQL> archive log liset
SP2-0718: illegal ARCHIVE LOG option
SQL> archive log list
ORA-01034: ORACLE not available
SQL> startup mount
ORACLE instance started.
Total System Global Area 293601280 bytes
Fixed Size 1219040 bytes
Variable Size 92276256 bytes
Database Buffers 197132288 bytes
Redo Buffers 2973696 bytes
Database mounted.
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 6
Next log sequence to archive 8
Current log sequence 8
SQL> alter database open
2 ;
Database altered.
SQL> show user;
USER is "SYS"
SQL> show parameter db_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string orcl
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
ORCL
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
[oracle@localhost ~]$ su -
鍙d护锛?[root@localhost ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:80:90:87
inet addr:192.168.2.5 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe80:9087/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:22 errors:0 dropped:0 overruns:0 frame:0
TX packets:46 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:5013 (4.8 KiB) TX bytes:8236 (8.0 KiB)
Interrupt:169 Base address:0x2000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:3692 errors:0 dropped:0 overruns:0 frame:0
TX packets:3692 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3756577 (3.5 MiB) TX bytes:3756577 (3.5 MiB)
[root@localhost ~]# su - oracle
[oracle@localhost ~]$ ping 192.168.2.3
PING 192.168.2.3 (192.168.2.3) 56(84) bytes of data.
64 bytes from 192.168.2.3: icmp_seq=1 ttl=128 time=8.04 ms
64 bytes from 192.168.2.3: icmp_seq=2 ttl=128 time=0.818 ms
64 bytes from 192.168.2.3: icmp_seq=3 ttl=128 time=0.855 ms
64 bytes from 192.168.2.3: icmp_seq=4 ttl=128 time=0.189 ms
--- 192.168.2.3 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 2999ms
rtt min/avg/max/mdev = 0.189/2.477/8.046/3.226 ms
[oracle@localhost ~]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Mon Dec 26 17:18:00 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORCL (DBID=1295949506)
RMAN> show all
2> ;
using target database control file instead of recovery catalog
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/10.2.0/db_1/dbs/snapcf_ORCL.f'; # default
RMAN> exit;
Recovery Manager complete.
[oracle@localhost ~]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Dec 26 17:20:28 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> conn / as sysdba
Connected.
SQL> desc v$flash_recovery_area_usage;
Name Null? Type
----------------------------------------- -------- ----------------------------
FILE_TYPE VARCHAR2(12)
PERCENT_SPACE_USED NUMBER
PERCENT_SPACE_RECLAIMABLE NUMBER
NUMBER_OF_FILES NUMBER
SQL> select * from v$flash_recovery_area_usage;
FILE_TYPE PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE NUMBER_OF_FILES
------------ ------------------ ------------------------- ---------------
CONTROLFILE 0 0 0
ONLINELOG 0 0 0
ARCHIVELOG 1.73 0 2
BACKUPPIECE 0 0 0
IMAGECOPY 0 0 0
FLASHBACKLOG 0 0 0
6 rows selected.
SQL> show user;
USER is "SYS"
SQL> show parameter control_file_record_keep_time;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time integer 7
SQL> alter system set control_file_record_keep_time=14 scope=spfile;
System altered.
5. 在windows操作系统上面用恢复目录操作的脚本如下: