16 Temmuz 2018 Pazartesi

Set Environment Variable in the Listener.ora

 Sometimes you need to use a variable (as a parameter) while dealing with RMAN or SQL*Plus.

 For example, you may want to use a parameter while taking your RMAN backup such as:


As you see above, I exported BACKUP_TYPE as an environment variable to determine my backup format and I used it in my rman command.


Now, assume that I'm working on a RAC, I'm still running my backup commands from 1st instance but I want to backup my database from 2nd instance or I need to open channels on both instances. So, I should use TNS  to connect other instance via RMAN:




As you see, my rman backup command failed. The reason is BACKUP_TYPE variable is not passed after connected to 2nd instance.

The solution for this problem is passing the environment variable inside listener.ora like the following;


Step 1:   Configure a second listener in the listener.ora on the 2nd instance's grid home with different port and with my environment variable










Step2: Configure my tns entry (TEST2) to connect the 2nd instance with new listener:













Step3: Connet the 2nd instance by RMAN with new listener and try backup database with our environment variable:



















 At this time, when you connect the database by TNS, our environment variable is passed to the new connection.


Step 4: Also verify our environment variable is really set for our new listener:








Hiç yorum yok:

Yorum Gönder