Oracle RAC RMAN备份无法写入NFS共享的问题求助
Environment Details:
- RMAN Backup Script:
run { SET nocfau; ALLOCATE CHANNEL CH0 DEVICE TYPE DISK FORMAT '/nfs/datafile/%U_%T'; ALLOCATE CHANNEL CH1 DEVICE TYPE DISK FORMAT '/nfs/datafile/%U_%T'; ALLOCATE CHANNEL CH2 DEVICE TYPE DISK FORMAT '/nfs/datafile/%U_%T'; ALLOCATE CHANNEL CH3 DEVICE TYPE DISK FORMAT '/nfs/datafile/%U_%T'; BACKUP AS COPY INCREMENTAL LEVEL 0 TAG 'INCR_MERGE' DATABASE; BACKUP ARCHIVELOG ALL FORMAT '/nfs/archivelogs/%U' NOT BACKED UP 1 TIMES; RELEASE CHANNEL CH0; RELEASE CHANNEL CH1; RELEASE CHANNEL CH2; RELEASE CHANNEL CH3; }- NFS Client Mount Options:
rw,user,hard,noac,vers=4- NFS Server Export Config:
NFSv4,rw,no_root_squash,no_all_squash,secure- Issue: Manual NFS writes work, but RMAN backup hangs with no output; 19c test throws
ORA-17500: ODM err: No such file or directory
Let's break down your Oracle RAC RMAN backup issue step by step—since local backups work and basic NFS writes succeed manually, the problem is almost certainly tied to permission mapping, directory structure, or NFS tuning for RMAN's specific workload.
1. Validate UID/GID Consistency Across All Systems
Your NFS export uses no_root_squash, but that only applies to the root user. For the oracle user, if its UID/GID doesn't match exactly between your RAC nodes (clients) and the NFS server, the server will map it to an anonymous user (usually nobody), which blocks write access even if you can copy files manually (maybe you tested as root, not oracle).
- Run
id oracleon every RAC node and the NFS server. Ensure the UID (e.g.,uid=54321(oracle)) and primary GID are identical everywhere. - If there's a mismatch, adjust the
oracleuser's UID/GID to align (don't forget to update ownership of Oracle-related files afterward to avoid new permission issues).
2. Verify NFS Mount Paths and Directory Permissions
Your RMAN script targets /nfs/datafile/, but the error references /home/oracle/nfs/ractest/...—double-check that these paths are actually mounted to your NFS share, and that the parent directories have the right permissions for the oracle user:
- On RAC nodes, run
mount | grep nfsto confirm the NFS share is mounted at the path RMAN is using. - Check directory permissions (run as
oracleuser, not root):
If thesu - oracle ls -ld /nfs/datafile/ ls -ld /home/oracle/nfs/ractest/1178998226/full/datafile/ touch /home/oracle/nfs/ractest/1178998226/full/datafile/test_backup_filetouchcommand fails, you've confirmed a permission issue on the NFS share.
3. Address ASM Group vs Oracle User Mismatch
You noted local data files are owned by asmadmin, but oracle isn't in that group. This shouldn't block RMAN backups to NFS—RMAN reads data files via Oracle's database processes (which have access to ASM) and writes backup files as the oracle user. The problem isn't replicating source file permissions; it's that the NFS directory doesn't allow oracle to create files.
4. Tune NFS Mount Options for RMAN Workloads
Your noac (no attribute caching) mount option explains the frequent GETATTR requests in nfsiostat. While noac ensures consistency, it adds overhead for large RMAN backups. Adjust your options to balance reliability and performance:
- Add
rsize=1048576,wsize=1048576to use 1MB read/write blocks (optimal for large file transfers). - Keep
hard(safer for critical backups) but consider addingtimeo=600to reduce timeout-related hangs. - Remount the share with updated options:
umount /nfs/datafile mount -t nfs4 -o rw,user,hard,noac,vers=4,rsize=1048576,wsize=1048576,timeo=600 <nfs-server-ip>:/export/path /nfs/datafile
5. Adjust RMAN Channel Configuration
Your 4-channel setup is reasonable, but make these tweaks to avoid common pitfalls:
- Ensure the target directory exists before running the backup—RMAN won't create nested directories automatically in some cases.
- Add
MAXOPENFILES 8to each channel to limit concurrent file opens, reducing NFS contention:ALLOCATE CHANNEL CH0 DEVICE TYPE DISK FORMAT '/nfs/datafile/%U_%T' MAXOPENFILES 8; - Optional: Add directory validation to your script to confirm write access upfront:
run { SET nocfau; ALLOCATE CHANNEL CH0 DEVICE TYPE DISK FORMAT '/nfs/datafile/%U_%T' MAXOPENFILES 8; ALLOCATE CHANNEL CH1 DEVICE TYPE DISK FORMAT '/nfs/datafile/%U_%T' MAXOPENFILES 8; ALLOCATE CHANNEL CH2 DEVICE TYPE DISK FORMAT '/nfs/datafile/%U_%T' MAXOPENFILES 8; ALLOCATE CHANNEL CH3 DEVICE TYPE DISK FORMAT '/nfs/datafile/%U_%T' MAXOPENFILES 8; -- Validate write access to backup directory SQL 'CREATE OR REPLACE DIRECTORY rman_backup AS ''/nfs/datafile'''; SQL 'GRANT READ, WRITE ON DIRECTORY rman_backup TO sys'; BACKUP AS COPY INCREMENTAL LEVEL 0 TAG 'INCR_MERGE' DATABASE; BACKUP ARCHIVELOG ALL FORMAT '/nfs/archivelogs/%U' NOT BACKED UP 1 TIMES; RELEASE CHANNEL CH0; RELEASE CHANNEL CH1; RELEASE CHANNEL CH2; RELEASE CHANNEL CH3; }
6. Check Logs for Hidden Clues
- On the NFS server, check
/var/log/messagesor/var/log/syslogfor entries about permission denied or UID mapping failures when the RMAN backup runs. - On RAC nodes, check the Oracle alert log (
$ORACLE_BASE/diag/rdbms/<dbname>/<instname>/trace/alert_<instname>.log) for detailed errors beyond the RMAN-03009 message.
内容的提问来源于stack exchange,提问作者AAB

