PowerShell script exchange
Post Reply
pmowork
Novice
Posts: 7
Liked: never
Joined: Oct 15, 2021 3:41 pm
Full Name: pmo work
Contact:

How to get Database Object from a PG with linux/oracle servers ?

Post by pmowork »

Hello
We have a Protection Group PG that contains 2 linux servers that have several databases on them, like this example
PG
> LinuxA
- oracle installation 19c_1
+ db1
+ db2
- oracle installation 19c_2
+ db3

How can I select the database db3 from install "19c_2" of LinuxA with Powershell command to populate $DBLinuxObject variable to then create an Applicationjob with the following command ?

Code: Select all

Add-VBRApplicationBackupJob -BackupObject $DBLinuxObject -BackupRepository $Repository -Name "TEST ORA" -Description "Daily backup of ORA systems" -BackupOptions $BackupOptions  -ScheduleOptions $ScheduleOptions -DatabaseProcessingOptions $DBProcessOptions -OracleRMANOptions $ORARMANOptions -OracleRMANStorageOptions $ORARMANStorageOptions
I could get Linux servers from PG with

Code: Select all

  $PG = Get-VBRProtectionGroup -name "TEST_PG"
  $PG.Container
But I dont know how to get database from one server ?

Best Regards
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 669 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: How to get Database Object from a PG with linux/oracle servers ?

Post by oleg.feoktistov »

Hi,

Try Get-VBRDiscoveredApplication cmdlet.

Best regards,
Oleg
pmowork
Novice
Posts: 7
Liked: never
Joined: Oct 15, 2021 3:41 pm
Full Name: pmo work
Contact:

Re: How to get Database Object from a PG with linux/oracle servers ?

Post by pmowork »

Hello Oleg
Thanks a lot
I continue my tests with this cmdlet
Best Regards
pmowork
Novice
Posts: 7
Liked: never
Joined: Oct 15, 2021 3:41 pm
Full Name: pmo work
Contact:

Re: How to get Database Object from a PG with linux/oracle servers ?

Post by pmowork »

Hello
With the help of Oleg's answer, I could script the creation of an oracle application-backup-job with Powershell
I share you the code of my test if it could help someone else :-)

Code: Select all

$ORACLE_SERVER                      = 'server1'
$ORACLE_INSTANCE                    = 'ORA_INS1'
$VEEAM_OSUSRNAME                    = 'veeambck'
$VEEAM_OSUSRDESC                    = 'veeambck (SSH)'
$VEEAM_AUTHMODE                     = 'OSAuth'
$VEEAM_STORAGE_REPOSITORY           = 'VEEAM_REPOS'
$VEEAM_STORAGE_RETENTION_POLICY     = 7
$VEEAM_BACKUP_FULL_MODE             = 'Differential'
$VEEAM_BACKUP_FULL_0_FREQUENCY      = 'Weekly'
$VEEAM_BACKUP_FULL_0_TYPE           = 'Everyday'
$VEEAM_BACKUP_FULL_RMANCHANNEL      = 4
$VEEAM_DB_ARCHLOG_FREQUENCY         = 60
$VEEAM_DB_ARCHLOG_RMANCHANNEL       = 4
$VEEAM_SCHEDULE_BACKUP_TYPE         = 'Daily'
$VEEAM_SCHEDULE_BACKUP_FREQUENCY    = 'Everyday'
$VEEAM_SCHEDULE_BACKUP_PERIODETIME  = '14:00'
$VEEAM_SCHEDULE_RETRY_COUNT         = 3
$VEEAM_SCHEDULE_RETRY_TIMEOUT       = 10

<##
Control Object 
##>
$VBR_Credential = Get-VBRCredentials -Name $VEEAM_OSUSRNAME | Where-Object { $_.Description -eq $VEEAM_OSUSRDESC }
$VBR_ORASRV = Get-VBRDiscoveredApplication -OracleRMANEntityType Server -Name $ORACLE_SERVER
$VBR_ORADB = Get-VBRDiscoveredApplication -OracleRMANEntityType Database -Name $ORACLE_INSTANCE

<##
Storage -> 
  Repository = VEEAM_REPOS
  Retention = 7
  Advanced ...
     > backup : mode = diff / cumul ; level 0 = Tuesday
     > storage : compress YES|NO
     > notif : Send e-mail YES | NO + config
     > oracle  : RMAN channels = 4
##>
$VBR_Repository = Get-VBRBackupRepository -Name $VEEAM_STORAGE_REPOSITORY
$VBR_ORARMANOptions = New-VBROracleRMANOptions -ParallelChannelsCount $VEEAM_BACKUP_FULL_RMANCHANNEL
# Create an empty OracleRMAN Storage Options
$VBR_ORARMANStorageOptions = New-VBROracleRMANStorageOptions 
$VBR_Notifications = New-VBRNotificationOptions -EnableAdditionalNotification -AdditionalAddress pmonschein@groupe-casino.fr -UseNotificationOptions -NotifyOnSuccess -NotifyOnWarning -NotifyOnError

<##
DB processing :
  > Processing 
     Authen mode = OSAuth
     Specify OS = uveeambck
     Archived Logs = Do Not Delete | Delete
     Backup archvied redo logs every = 60
     Parallel processing  RMAN = 1
##>
$VBR_ORARMAN_ProcessingOptions = New-VBROracleRMANProcessingOptions -Credentials $VBR_Credential -AuthenticationMode $VEEAM_AUTHMODE -ArchivedLogAction Delete -ArchiveLogBackupPeriod $VEEAM_DB_ARCHLOG_FREQUENCY -ParallelChannelsCount $VEEAM_DB_ARCHLOG_RMANCHANNEL
$VBR_PlugDBOptions = New-VBRPluggableDatabasesOptions -ProcessingMode All
$VBR_DBProcessOptions = New-VBRDatabaseProcessingOptions -BackupObject $VBR_ORADB -OracleRMANProcessingOptions $VBR_ORARMAN_ProcessingOptions -PluggableDatabasesOptions $VBR_PlugDBOptions

<##
Schedule :
  Run Job Auto : YES | NO
    * daily : 14h00 on these days = everydays
  Automatic retry : 3 times / 10 minutes
##>
$VBR_BackupOptions = New-VBRApplicationBackupOptions -BackupMode $VEEAM_BACKUP_FULL_MODE -FullBackupScheduleType $VEEAM_BACKUP_FULL_0_FREQUENCY -WeeklyScheduleType $VEEAM_BACKUP_FULL_0_TYPE
$VBR_DailyOptions = New-VBRDailyOptions -Type $VEEAM_SCHEDULE_BACKUP_FREQUENCY -Period $VEEAM_SCHEDULE_BACKUP_PERIODETIME
$VBR_ScheduleOptions = New-VBRApplicationScheduleOptions -Type $VEEAM_SCHEDULE_BACKUP_TYPE -DailyOptions $VBR_DailyOptions -EnableRetry -RetryCount $VEEAM_SCHEDULE_RETRY_COUNT -RetryTimeout $VEEAM_SCHEDULE_RETRY_TIMEOUT

<##
Create Bkp-Appli-Job
##>
$VBR_BACKUPJOB_NAME = "BKPJOB_ORA_$($ORACLE_SERVER)_$($ORACLE_INSTANCE)"
$VBR_BACKUPJOB_DESC = "Backup Oracle Instance $($ORACLE_INSTANCE) on $($ORACLE_SERVER) / Retention Policy = $VEEAM_STORAGE_RETENTION_POLICY"
$VBR_BACKUPJOB_DESC += "`r`n" + "Full0 Mode = $VEEAM_BACKUP_FULL_MODE / RMAN nb channel = $VEEAM_BACKUP_FULL_RMANCHANNEL / ArchLogs Frequency = $VEEAM_DB_ARCHLOG_FREQUENCY "

$VBR_AppBackupJob = Add-VBRApplicationBackupJob -BackupObject $VBR_ORADB -BackupRepository $VBR_Repository -Name $VBR_BACKUPJOB_NAME -Description $VBR_BACKUPJOB_DESC `
-RetentionPolicy $VEEAM_STORAGE_RETENTION_POLICY -EnableSchedule -BackupOptions $VBR_BackupOptions -DatabaseProcessingOptions $VBR_DBProcessOptions `
-OracleRMANOptions $VBR_ORARMANOptions -OracleRMANStorageOptions $VBR_ORARMANStorageOptions `
-ScheduleOptions $VBR_ScheduleOptions -NotificationOptions $VBR_Notifications

<##
Enable Bkp-Appli-Job
##>
Enable-VBRApplicationBackupJob -Job $VBR_AppBackupJob


Pascal
Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests