2015年11月25日 星期三

nfs server step

Server 端

Using NFS to Share Files

NFS (Network File System) is another way of sharing files across a network. It is used primarily in Linux and UNIX systems, although there are NFS clients for Windows.

Installing NFS

1. Use the following command to install NFS:
   rpm -qa nfs-utils nfs-utils-lib 檢查有無安裝 NFS Package
 
   or

   yum -y install nfs-utils nfs-utils-lib

Configuring NFS

Configuration of NFS is pretty simple. You add the directories you wish to export to the file /etc/exports.

2. Create a directory called /public with the following command:

   mkdir -p /u01/app/oracle/oradata/arch

3. Next, edit the file /etc/exports:

   vi /etc/exports

4. Add the following line to /etc/exports:
   
   ex: /public    *(ro,sync)

   /u01/app/oracle/oradata/arch 10.1.1.59(rw,no_root_squash,no_all_squash,sync)

5. Mount
   [root@standby ~]# exportfs -r 重新掛載 /etc/exports 裡面的設定
   [root@standby ~]# exportfs -v
   /u01/app/oracle/oradata/arch 10.1.1.59(rw,wdelay,no_root_squash,no_subtree_check,anonuid=65534,anongid=65534)
   [root@standby ~]# showmount -e localhost
   Export list for localhost:
   /u01/app/oracle/oradata/arch 10.1.1.59

Then, start the nfs server:

        /etc/rc.d/init.d/nfs start

Client 端

確認是否有 server 端是否有提供 NFS 掛載
[root@primary ~]$ showmount -e 10.1.1.60
Export list for 10.1.1.60:
/u01/app/oracle/oradata/arch 10.1.1.59

--add parameter
vim /etc/fstab
10.1.1.60:/u01/app/oracle/oradata/arch    /u01/app/oracle/oradata/arch               nfs     rw              0 0

手動 mount
# mount -t nfs 10.1.1.60:/u01/app/oracle/oradata/arch /u01/app/oracle/oradata/arch

若 alert log file 出現下面錯誤訊息
ORA-27086: unable to lock file - already in use
Linux-x86_64 Error: 37: No locks available
Additional information: 10

解决方法:掛載時使用 nolock 參數
# umount /u02/arch/
# mount -o nolock -t nfs 10.1.1.60:/backup/arch /u02/arch/

How to reset the log sequence number in an Oracle database

[oracle@rman-recovery-test archivelog]$ sqlplus "/as sysdba"

SQL*Plus: Release 10.2.0.5.0 - Production on Tue May 26 16:47:57 2015

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area 2097152000 bytes
Fixed Size                  2097592 bytes
Variable Size            1979715144 bytes
Database Buffers          100663296 bytes
Redo Buffers               14675968 bytes
Database mounted.

SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01139: RESETLOGS option only valid after an incomplete database recovery


SQL> recover database until cancel;
Media recovery complete.
SQL> alter database open resetlogs;

Database altered.

SQL>


SQL> select open_mode from v$database;

delete archive log file

SQL> alter system archive log current;

SQL> /

SQL> /

SQL> archvie log list;


手動清除v$ARCHIVED_LOG中不管是DELETED還是available 記錄的方法,注意不要在你的產品資料庫上這樣做:

SQL> select count(*) from v$archived_log;
COUNT(*)
———
553

SQL> execute sys.dbms_backup_restore.resetCfileSection(11);
PL/SQL procedure successfully completed.
SQL> select count(*) from v$archived_log;
COUNT(*)
———
0

========================================================================
PROCEDURE resetCfileSection(record_type IN binary_integer );
— This procedure attempts to reset the circular controlfile section.

— Input parameters:
— record_type
— The circular record type whose controlfile section is to be reset.

execute sys.dbms_backup_restore.resetCfileSection(11);  ==> 清理v$ARCHIVED_LOG對應的記錄
execute sys.dbms_backup_restore.resetCfileSection(28);  ==>清理v$rman_status對應的記錄

以上是2個例子,具體的section_id可以這樣獲得:

SQL>  select rownum-1, type from v$controlfile_record_section

ROWNUM-1 TYPE
——— —————————
0 DATABASE
1 CKPT PROGRESS
2 REDO THREAD
3 REDO LOG
4 DATAFILE
5 FILENAME
6 TABLESPACE
7 TEMPORARY FILENAME
8 RMAN CONFIGURATION
9 LOG HISTORY
10 OFFLINE RANGE
11 ARCHIVED LOG
12 BACKUP SET
13 BACKUP PIECE
14 BACKUP DATAFILE
15 BACKUP REDOLOG
16 DATAFILE COPY
17 BACKUP CORRUPTION
18 COPY CORRUPTION
19 DELETED OBJECT
20 PROXY COPY
21 BACKUP SPFILE
22 DATABASE INCARNATION
23 FLASHBACK LOG
24 RECOVERY DESTINATION
25 INSTANCE SPACE RESERVATION
26 REMOVABLE RECOVERY FILES
27 RMAN STATUS
28 THREAD INSTANCE NAME MAPPING
29 MTTR
30 DATAFILE HISTORY
31 STANDBY DATABASE MATRIX
32 GUARANTEED RESTORE POINT
33 RESTORE POINT