NWBACKUP.sh – A free script to perform a full or incremental backup of a directory to a NetWorker Pool
Networker
0
The nwbackup.sh is the bash script that uses the save and the mminfo command of the lgto* packages. To be able to use the script you must install both the lgtoxtdclnt and lgtoxtdclnt packages.
[root@dbpilot.net ~]# rpm -qa |egrep "lgtoclnt|lgtoxtdclnt" lgtoxtdclnt-19.1.0.3-1 lgtoclnt-19.1.0.3-1
Also, At the row 31 of the script you must modify the “NetworkerServer” variable to match your Networker server.
The latest version of the script is with following header “$Header 10:12 27-Jan-20 (001.014)”
All details about how to use the script you can find in the script’s help
[root@dbpilot ~]# ./nwbackup.sh help ./nwbackup.sh full|incr boostpool= dir="dir1:redundance1" dir="dir2:redandace2" [rd=] [debug] [help] [nocolor] [estimate_only] [expiration_date=] [cross_mount_points] [list_backups|list_backups=] full - Performs a full backup of a specified directory. incr - Performs a incremental backup of a specified directory. boostpool - The Networker Destination Media Pool where a backup will be saved. The short version is p=. dir - The parameter of this option is made up of 2 parts separated by the colon. The first value defines a directory to be backed up. The second value can be either a number, the md or the ka strings. A number defines a number of full backup copies to be kept after a backup is completed. Use the ka [Keep All] if you want to eliminate deleting of any backup for a specified directory in a current backup session. The md means that a backup requires manual deletion and will never be deleted by the script. Be careful when specifying a directory path. A path with the trailing slash(/) at the end is not the same as a path without the trailing slash at the end. For instance, the script will treats /tmp and /tmp/ as 2 different directories. rd - Sets a default redundancy policy for all backups in a current backup session. It's a number of full backup copies to be kept after the script has completed. This parameter is ignored for all directories for which you explicitly has specified redundancy policy through the dir parameter. If the rd option is not specified then a backup deletion are processed only for directories with an explicitly specified redundancy policy. If no backup is to be deleted by the script in the current backup session then do not specify both the redundance part of the dir option and the rd option. debug - Prints a detailed script's output. help - Prints this message. nocolor - Disables colors in the script output when a backup is beeing performed. expiration_date - Sets the date when a backup will expire. It overwrites an existing browse and retention time specified for a specific client. It can be any valid date in the future. Default is 17 Jan 2038 23:59:59 [2147385599]. The expiration_date option does not guarantee that a backup won't be deleted. The option is to overwrite a default browse and retention time for a client. To guarantee a backup won't be deleted by the script use the dir option with the md parameter. list_backups - Prints all available backups for the current client. The short version of the option is ls. list_backups= - Prints backups matching a specified mask. The short version of the option is ls=. NOTE 1 - An incremental backup of type md [Manual Deletion] can be based only on a full backup of the same type. NETWRK_FULL or NETWRK_INCR - A backup of this type will be deleted by the script according to a specified redundancy. MANUAL_FULL or MANUAL_INCR - A backup that must be deleted manually. NOTE 2 - The script should not be used to backup a mounted directory on a local server. Run it on a remote server instead. NOTE 3 - An incremental backup of the script is based on usage of the -t parameter of the save command (see man save). You can face a situation when performing an incremental backup of a catalog for a specific date you get a full backup instead of an incremental one, even if no new files were placed in that catalog and files itself were not modified at all. This unwanted behavior of the save command is due to files metadata changes. Even if the content of files wasn't modified their metadata could be changed. For instance, changing files permissions will change their metadata too but not files itself. In this case, files will have the same modify timestamps as before but newer metadata modification timestamps. You can use the stat command for such files to confirm that. As a result of files metadata changes, the save will decide the files were modified and must be backed up, despite the content of files actually was not modified. If metadata weren't changed they would be skipped during an incremental backup as content of these files were not modified. -------------------------------------------------------------------------------- Creates a full backup of every specified directory to the Netwoker pool BoostPool1. No backup for the / directory will be deleted in the current backup session. Leaves 2 copies of full backups of the /var directory after the script completion. Leaves 5 copies of full backups of the /home directory after the script completion. -------------------------------------------------------------------------------- ./nwbackup.sh full p=BoostPool1 dir="/:ka" dir="/opt:2" dir="/home" rd=5 -------------------------------------------------------------------------------- Creates a full backup of every specified directory to the Netwoker pool BoostPool1. Leaves 1 copy of the latest full backup of the / directory after the script completion. For the /project directory a backup of type "manual" will be created. This kind of backup will be ignored by the script redundancy policy and it must be deleted manually. The option rd=10 is ignored in this backup session. -------------------------------------------------------------------------------- ./nwbackup.sh full boostpool=BoostPool1 dir="/:1" dir="/project:md" dir="/home" rd=10 -------------------------------------------------------------------------------- Creates a full backup of every specified directory to the Netwoker pool BoostPool1. No backup will be deleted in the current backup session. -------------------------------------------------------------------------------- ./nwbackup.sh full p=BoostPool1 dir="/" dir="/opt" dir="/home" -------------------------------------------------------------------------------- Prints all backups having the "/project" string in its name. -------------------------------------------------------------------------------- ./nwbackup.sh list_backups=/project -------------------------------------------------------------------------------- Prints all available backups for the current client. -------------------------------------------------------------------------------- ./nwbackup.sh ls
Example,
The following command will create a incr backup of /tmp directory to the BoostPool1 pool
## Get list of the currenct available backups [root@dbpilot ~]# ./nwbackup.sh ls --------------------------------------------------------------------------------------------------------- Backup Size | Start Time [Human] | [Unix] | Completed | Retention | Browse | SSID | Backup Name --------------------------------------------------------------------------------------------------------- 3427 KB 01/28/2020 09:47:04 AM 1580194024 01/28/2020 01/17/2038 01/17/2038 2033178856 NETWRK_FULL.28JAN2020_094704.+/tmp 4 B 01/28/2020 09:47:38 AM 1580194058 01/28/2020 01/17/2038 01/17/2038 2016401674 NETWRK_INCR.28JAN2020_094738.1580194024.+/tmp 4 B 01/28/2020 09:47:47 AM 1580194067 01/28/2020 01/17/2038 01/17/2038 1999624468 NETWRK_INCR.28JAN2020_094747.1580194058.+/tmp ## Create a new incremental backup of /tmp directory. Only 1 copy of full backup of the /tmp direcotry will be left after the script completion [root@dbpilot.net ~]# ./nwbackup.sh full dir=/tmp p=BoostPool1 rd=1 .................................................. .. A directories existence check .................................................. [ OK ] : /tmp .................................................. .. Backing up the specified directories .................................................. .. NETWRK_FULL.28JAN2020_094808.+/tmp Started [ OK ] [09:48:08 28-Jan-2020] Ended [ OK ] [09:48:15 28-Jan-2020] Elapsed 7 seconds .................................................. .. Deleting obsolete backups .................................................. .. List of backups to be purged for the /tmp ---------------------------------------------------------------------------------- Backup Size | Timestamp [Human] | Timestamp [Unix]| Backup SSID | Backup Name ---------------------------------------------------------------------------------- 3427 KB 01/28/2020 09:47:04 AM 1580194024 2033178856 NETWRK_FULL.28JAN2020_094704.+/tmp 4 B 01/28/2020 09:47:38 AM 1580194058 2016401674 NETWRK_INCR.28JAN2020_094738.1580194024.+/tmp 4 B 01/28/2020 09:47:47 AM 1580194067 1999624468 NETWRK_INCR.28JAN2020_094747.1580194058.+/tmp 2033178856 [ OK ] [09:48:22 28-Jan-2020] 2016401674 [ OK ] [09:48:28 28-Jan-2020] 1999624468 [ OK ] [09:48:35 28-Jan-2020] .................................................. .. A list of available backups .................................................. .. /tmp ---------------------------------------------------------------------------------- Backup Size | Timestamp [Human] | Timestamp [Unix]| Backup SSID | Backup Name ---------------------------------------------------------------------------------- 3427 KB 01/28/2020 09:48:10 AM 1580194090 1982847274 NETWRK_FULL.28JAN2020_094808.+/tmp The script has completed successfully. Tue Jan 28 09:48:35 MSK 2020 ## Check available backups again [root@dbpilot.net ~]# ./nwbackup.sh ls --------------------------------------------------------------------------------------------------------- Backup Size | Start Time [Human] | [Unix] | Completed | Retention | Browse | SSID | Backup Name --------------------------------------------------------------------------------------------------------- 3427 KB 01/28/2020 09:48:10 AM 1580194090 01/28/2020 01/17/2038 01/17/2038 1982847274 NETWRK_FULL.28JAN2020_094808.+/tmp
Related Posts
Leave a Reply Cancel reply
This site uses Akismet to reduce spam. Learn how your comment data is processed.
Categories
- Linux (8)
- Iptables (2)
- Memory Usage (1)
- Postfix (1)
- Yum (4)
- Networker (2)
- Oracle (63)
- Account (2)
- AWR (2)
- Database Errors (6)
- Database Performance (9)
- Datapump (3)
- Enterprise Manager (24)
- Enterprise Manager Metrics (4)
- Environments (4)
- High CPU Usage (2)
- High IO Load (4)
- Initialization Parameters (5)
- job_queue_processes (1)
- Processes (3)
- NLS (1)
- Objects (1)
- Objects DDL (2)
- OJVM/PSU/DRU Patches (1)
- PL/SQL (5)
- UTL_FILE (4)
- Prerequisites (1)
- Privileges (1)
- Profile (1)
- Queries (2)
- Redologs (1)
- Resource Limits (1)
- Segment Shrink (1)
- Session (6)
- Spfile (3)
- SQL PLUS (1)
- Spooling (1)
- Standard Queries (7)
- Statistics (2)
- Temporary Tablespace (2)
Tags
/etc/sudoers
Account
Agent
Agent 12c Deinstall
Agent 13c Deployment
Automated Maintenance Tasks
AWR
BLOCKING SESSION
Database Auditing
Database Directory
Database Performance
Datapump
DBMS_SYSTEM
Enterprise Manager
Enterprise Manager Metrics
Failed Logins (Historical) Metric
Failed Logins Metric
Gather Statistics Job
GET_ENV
High IO Load
Idle Sessions
Initialization Parameters
LOCKED(TIMED)
OEM
OEM 12.1.0.4
OEM 13.1.0.0.0
OMS
Processes
Repository
Retrieve Object DDL
ROW LOCK
Scheduler
Schema Statistics
Scripts
Sessions
spfile
SQL_ID
Standard Query
TRANSACTION
User Grants
UTL_FILE
WAITING SESSION
Window Group
Window Name
Yum