Clone Database From NetBackup…Or..”Where Is The Tape, Watson?”

When cloning a live database, this has it’s impact on the live database..open door, I know, but still, it’s a fact. This is not always what we want, since the users can have a lot of issues and even on a test database, deadlines seem to apply.

To remedy this issue, and get the most out of our investment, we decided to clone a database (CLONE! not restore, this is another post on this blog!) from the latest backup we’ve had from the source database. Since we have it, why not using it?

The main reason? Speed. The source database was not loaded in any way at all, and the Netbackup infrastructure is basically not used during business hours, since the backups take place at night. When I try to sleep, or play with the XBox One..;-)

To get started, what do we need?

  • Empty storage to hold the cloned database.
  • The location of the database backup (backup server and backup client names).
  • Enough permissions to read the backup.
  • This blog. ūüėČ

First: check if the backup actually succeeded. Yes, you can asume, but this really is an issue when you have to restore and find out the version you need is not really accessible.

If there is some information that seems to “just be there”, like where is the control file listing coming from in this post, please search the blog, basically all key information is documented on this blog. Or just send me a message, and I’ll clarify and update this post.

Let’s roll!

Open a terminal on the server where the clone needs to be located. There we need to determine the backup we want to use for the clone:

$ /usr/openv/netbackup/bin/bplist -S backup_Server -C backup_client -t 4 -l -R  -I -keyword "*DUMMY*" /

This provides us with the following list:

-rw-rw---- oracle    dba          30932992 Nov 02 02:08 /c-377112624-20161102-02
-rw-rw---- oracle    dba          30932992 Nov 02 02:07 /ctrl_dDUMMY_uvprjsa2u_s3065_p1_t926820446
-rw-rw---- oracle    dba          30932992 Nov 02 02:06 /c-377112624-20161102-01
-rw-rw---- oracle    dba         736886784 Nov 02 02:05 /arch_dDUMMY_uvnrjs9uj_s3063_p1_t926820307
-rw-rw---- oracle    dba          30932992 Nov 02 02:04 /c-377112624-20161102-00
-rw-rw---- oracle    dba         281542656 Nov 02 00:35 /bk_dDUMMY_uvlrjs4n1_s3061_p1_t926814945
-rw-rw---- oracle    dba         327942144 Nov 01 23:00 /bk_dDUMMY_uvkrjrv4v_s3060_p1_t926809247
-rw-rw---- oracle    dba          30932992 Nov 01 02:08 /c-377112624-20161101-02
-rw-rw---- oracle    dba          30932992 Nov 01 02:07 /ctrl_dDUMMY_uvirjplmk_s3058_p1_t926734036
-rw-rw---- oracle    dba          30932992 Nov 01 02:06 /c-377112624-20161101-01
-rw-rw---- oracle    dba         756023296 Nov 01 02:04 /arch_dDUMMY_uvgrjplhv_s3056_p1_t926733887
-rw-rw---- oracle    dba          30932992 Nov 01 02:03 /c-377112624-20161101-00
-rw-rw---- oracle    dba         280494080 Nov 01 00:39 /bk_dDUMMY_uverjpgio_s3054_p1_t926728792
-rw-rw---- oracle    dba         325320704 Oct 31 23:00 /bk_dDUMMY_uvdrjpaot_s3053_p1_t926722845

Optionally the SPFILE can be restored and altered to be used by the clone as a startup, but since I maintain a standard template, it’s just as easy in our situation to create the pfile by hand. Saves a restore run. But use the step below if you want to restore the SPFILE also:

We want to use the latest backup, so select the following backupfile to restore:

/c-377112624-20161102-02

Create a connection to the netbackup server and restore the spfile.

RMAN> run {
allocate channel t1 type 'SBT_TAPE' parms 'ENV=(NB_ORA_CLIENT=client),SBT_LIBRARY=/usr/openv/netbackup/bin/libobk.so64';
send 'NB_ORA_SERV=server,NB_ORA_CLIENT=client';
restore spfile to '/tmp/spfile' from '/c-377112624-20161102-02';
release channel t1;
}

Copy the file over to the correct location, start an instance with this, create pfile, alter settings, create new spfile, start a new instance with this spfile..etc..You know the drill…

NOTE: Before we can restore the spfile, make sure the clone instance is available in NOMOUNT state! Otherwise RMAN cannot do much to help us..

NOTE: derived from some documentation, it might not hurt to set the following environment setting before starting RMAN:

$ export NB_ORA_CLIENT=client

In order to do the clone, we need to connect to the live database, however the data will be retrieved from the backup.

As such we need to connect RMAN like this:

$ rlwrap rman target sys/secret@exp04 auxiliary sys/secret@exp05

Recovery Manager: Release 11.2.0.4.0 - Production on Wed Nov 2 12:22:20 2016

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: EXP04 (DBID=344562624)
connected to auxiliary database: EXP05 (not mounted)

RMAN> run {
allocate channel t1 type 'SBT_TAPE' parms 'ENV=(NB_ORA_CLIENT=client),SBT_LIBRARY=/usr/openv/netbackup/bin/libobk.so64';
allocate auxiliary channel stby01 type disk;
allocate auxiliary channel chan01 type 'SBT_TAPE' parms 'ENV=(NB_ORA_CLIENT=client),SBT_LIBRARY=/usr/openv/netbackup/bin/libobk.so64';

send 'NB_ORA_SERV=server,NB_ORA_CLIENT=client';
SET NEWNAME FOR DATABASE TO '+DATA5DG';
DUPLICATE DATABASE TO exp05
NOFILENAMECHECK;
}

sent command to channel: stby01
sent command to channel: chan01

executing command: SET NEWNAME

Starting Duplicate Db at 02-NOV-16

contents of Memory Script:
{
sql clone "alter system set  control_files =
''+DATA5DG/EXP05/controlfile/current.258.926857701'', ''+FRA5DG/EXP05/controlfile/current.257.926857701'' comment=
''Set by RMAN'' scope=spfile";
sql clone "alter system set  db_name =
''EXP04'' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone "alter system set  db_unique_name =
''EXP05'' comment=
''Modified by RMAN duplicate'' scope=spfile";
shutdown clone immediate;
startup clone force nomount
restore clone primary controlfile;
alter clone database mount;
}
executing Memory Script

sql statement: alter system set  control_files =   ''+DATA5DG/EXP05/controlfile/current.258.926857701'', ''+FRACCDM5DG/EXP05/controlfile/current.257.926857701'' comment= ''Set by RMAN'' scope=spfile

sql statement: alter system set  db_name =  ''EXP04'' comment= ''Modified by RMAN duplicate'' scope=spfile

sql statement: alter system set  db_unique_name =  ''EXP05'' comment= ''Modified by RMAN duplicate'' scope=spfile

Oracle instance shut down

Oracle instance started

Total System Global Area   12827369472 bytes

Fixed Size                     2265224 bytes
Variable Size               3925872504 bytes
Database Buffers            8858370048 bytes
Redo Buffers                  40861696 bytes
allocated channel: stby01
channel stby01: SID=926 device type=DISK
allocated channel: chan01
channel chan01: SID=992 device type=SBT_TAPE
channel chan01: Veritas NetBackup for Oracle - Release 7.6 (2013111313)

Starting restore at 02-NOV-16

channel chan01: starting datafile backup set restore
channel chan01: restoring control file
channel chan01: reading from backup piece c-377112624-20161102-02
} channel chan01: piece handle=c-377112624-20161102-02 tag=TAG20161102T020823
channel chan01: restored backup piece 1
channel chan01: restore complete, elapsed time: 00:01:05
output file name=+DATA5DG/EXP05/controlfile/current.258.926857701
output file name=+FRA5DG/EXP05/controlfile/current.257.926857701
Finished restore at 02-NOV-16

database mounted

contents of Memory Script:
{
set until scn  6402052692;
set newname for datafile  1 to
"+DATA5DG";
set newname for datafile  2 to


executing command: SET NEWNAME
Starting restore at 02-NOV-16

channel chan01: starting datafile backup set restore
channel chan01: specifying datafile(s) to restore from backup set
channel chan01: restoring datafile 00002 to +DATA05DG
channel chan01: reading from backup piece bk_dEXP04_usjrjha6t_s2963_p1_t926460125
...

As is visible above: the controlfile is restored from tape, and the rest of the restore also gets the data from the backup lib, NOT from the live database, although we do have a connection to this.

After the data reading from tape is done, the output should look like the following:

...
datafile 77 switched to datafile copy
input datafile copy RECID=76 STAMP=926872015 file name=+DATA5DG/EXP05/datafile/za_indx.314.926870347
datafile 78 switched to datafile copy
input datafile copy RECID=77 STAMP=926872015 file name=+DATA5DG/EXP05/datafile/es_indx.315.926870413

Reenabling controlfile options for auxiliary database
Executing: alter database force logging

contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script

database opened
Finished Duplicate Db at 02-NOV-16
released channel: t1
released channel: stby01
released channel: chan01

RMAN>

And that’s it! When the process is complete, and has no errors (most will be related with running out of storage space, so check this first).

Note: This is a very careful approach, but it’s up to the DBA to allocate a lot more channels to speed up this process. I normally hit the four channels and complete the process a lot quicker than with just one..

Advertisements
Posted in Technical Stuff, Databases, ASM, backup | Tagged , , | Leave a comment

Alerting on Illegal Login..Or..”Catch Me If You Can”..

We had the requirement to generate an alert whenever a user was logging into the database while bypassing the application server. Although a lot of discussion is out there of using triggers or not, I opted for a trigger due to the advantages it gives me.

This trigger does not kick the user out, but does logs him/her and raises an alert.

Prereqs are to create a table to hold the ‘audit’ info, located anywhere but in the SYSTEM tablespace, and setting the permissions to have a user insert it’s information.

SQL> create table audit.login_program_info (LOGON_TIME date, USERNAME VARCHAR2(200),PROGRAM VARCHAR2(500),MACHINE VARCHAR2(500));
SQL> grant insert on audit.login_program_info to public;

Now we only want to have the illegal login, but not the monitoring and maintenance logins (there is another audit method for these, provided by Oracle).

The trigger code:

create or replace TRIGGER login_trigger
AFTER LOGON ON DATABASE

DECLARE
PRAGMA AUTONOMOUS_TRANSACTION;
loginDate date;
userAccount varchar2(200);
programma varchar2(200);
hostName varchar2(200);

BEGIN

select sysdate, username,program,machine into loginDate, userAccount,programma,hostName from v$session WHERE AUDSID = Sys_Context('USERENV', 'SESSIONID');

INSERT INTO audit.login_program_info values ( loginDate, userAccount,programma,hostName);
COMMIT;

if ( userAccount not in ('SYS','SYSTEM','DBSNMP') ) and (instr(upper(programma),'SOCKET') = 0)
then
begin
  EXECUTE IMMEDIATE 'ALTER SESSION SET smtp_out_server = ''mail.server.com''';
  UTL_MAIL.send(sender => 'oracle@'||sys_context('USERENV','DB_NAME')||'.server.com',
  recipients => 'admin@server.com',
  subject => 'Illegal Login Alert',
  message => 'The user '||userAccount|| ' is logged into the db ' ||sys_context('USERENV','DB_NAME')|| ' at ' ||to_Char(loginDate,'DD-MON-YYYY HH24:MI:SS')|| ' from '|| hostName ||' with program:'||programma,
  priority => 1,
  mime_type => 'text; charset=us-ascii');
 end;
end if;
END;

Note: don’t forget to clean out the table, over time it will fill up.. ūüėČ

This is just a basic mechanism to handle this, but easy to build out upon..

 

Posted in Databases | Tagged , , | Leave a comment

Oracle OEM 13c Metric Collection Error..Or..”Show Me The Graphs!”

When implementing the OEM 13C version, we have a server where we house about 16 databases. Adding the first bunch of the databases went like a breeze, but when all was said and done, we had 3 databases which didn’t want to be monitored..Removing, adding again, all to no avail..

Long story short:

The error message:

Message=Metric evaluation error start – Received an exception when evaluating sev_eval_proc for:Target name = [DBNAME]_SYS, metric_name = Response, metric_column = Status; Error msg = Target encountered metric erros; at least one member in in metric error.

(Yes, there are typos in the error message..for once, their not mine ūüėČ )

Selection_001

It is not the agent, it is not the (shared) oracle home…it’s the specific database self:

In 13c cloud control, database target status shows metric collection error as below:
“Dynamic Category property error, Get dynamic property error, No such metadata, Computation of a critical dynamic property failed. Retries Completed”

Computing dynamic properties of the target fails with below error:

<AGENT_INST_HOME>/bin>./emctl reload agent dynamicproperties DBNAME:oracle_database
Oracle Enterprise Manager Cloud Control 13c Release 1
Copyright (c) 1996, 2015 Oracle Corporation. All rights reserved.
---------------------------------------------------------------
EMD reload error:Target oracle_database.orcl is broken: 
Target {oracle_database.orcl} is broken: Dynamic Category property error,
Get dynamic property error,No such metadata - No valid queryDescriptor 
or executionDescriptor found for target [oracle_database.orcl$57] is 
broken: Dynamic Category property error,Get dynamic property error,
 No such metadata - No valid queryDescriptor or executionDescriptor 
found for target [oracle_database.DBNAME$66]

*Note: the dbname is Case Sensitive!

The dynamic properties are these:

There is no bundle_series column in dba_registry_history table for the problematic database as below:

SQL> desc dba_registry_history

Name Null? Type
----------------------------------------- -------- ----------------------------
ACTION_TIME TIMESTAMP(6)
ACTION VARCHAR2(30)
NAMESPACE VARCHAR2(30)
VERSION VARCHAR2(30)
ID NUMBER
COMMENTS VARCHAR2(255)

How to fix?

Fairly easy: just execute catbundle.sql on problematic database to ensure that bundle_series column exists in dba_registry_history table.

Example:

Log in as sys on the database.

SQL*Plus: Release 11.2.0.4.0 Production on Mon May 9 12:32:26 2016
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> @?/rdbms/admin/catbundle.sql
Enter value for 1: cpu
Enter value for 2: apply

PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.

....<snip>....

SQL> COMMIT;

Commit complete.

SQL> SPOOL off
SQL> SET echo off
Check the following log file for errors:
/oracle/11.2.0.4/base/cfgtoollogs/catbundle/catbundle_CPU_DBNAME_APPLY_2016May09_12_32_44.log

SQL>

Or just check the dba_registry_history table again:

SQL> desc dba_registry_history
Name Null? Type
---------------------------------------------------------------------------
ACTION_TIME TIMESTAMP(6)
ACTION VARCHAR2(30)
NAMESPACE VARCHAR2(30)
VERSION VARCHAR2(30)
ID NUMBER
BUNDLE_SERIES VARCHAR2(30)
COMMENTS VARCHAR2(255)

Tadaa!!

Re-run the metric collection again:

$ ./emctl reload agent dynamicproperties DBNAME:oracle_database
Oracle Enterprise Manager Cloud Control 13c Release 1
Copyright (c) 1996, 2015 Oracle Corporation.  All rights reserved.
---------------------------------------------------------------
EMD recompute dynprops completed successfully

Refresh the overview page in OEM, and all should be green..

 

 

Posted in Databases, Technical Stuff | Tagged , , | 8 Comments

Integrate OEM 13c With MS Active Directory..Or..”One Account To Rule Them All…”

There are some instructions on the internet floating around in order to integrate the OEM 13c (or basically Weblogic 12c) and OEM 13c with Microsoft Active Directory/LDAP.

However in our case things went not as smoothly as advertised (Duh!). We have two OEM installations (OEM 12c and OEM 13c) in our company, but using the same AD. One would expect to just copying the settings from the working installation (OEM 12c) to the new OEM (13c) and everything would be peachy..Alas…This was not so much what was happening on our site.

With the aid of Oracle Support (credit where credit is due!) we (they) where able to solve this issue..

Both for future reference and documentation I’m sharing the settings we needed to set to make the stack play together nicely..

I’m not going to re-write the excellent instructions provided by oracle with the video located here: Oracle AD instructions

When following the above instruction don’t work, continue with my experiences as a last resort before contacting Oracle Support..

Start with the basics and open the WebLogic Console in the browser:

Selection_013Log in, and navigate to the page indicated by the green bars:

Selection_014

The key is in the configuration parameters used (once again: duh!). Below are the settings which worked for our site:

 *note* anything NOT mentioned should be either default, or the same as in the tutorial video from oracle

Host:  <Domain Controller without domain name e.g. DC01 instead of DC01.domain.com >
Port:  389
Principal:  CN=XXXX,OU=Service Accounts,DC=company,DC=com
User Base DN:  DC=company,DC=com
All Users Filter:  <cleared/empty>
User From Name Filter: (&(sAMAccountName=%u)(objectclass=person))
User Name Attribute=sAMAccountName
 
Group Base DN:  OU=OEM,OU=Groups,OU=Global Accounts,OU=Company_Locations,DC=company,DC=com
All Groups Filter: <cleared/empty>
Group From Name Filter: (&(cn=%g)(objectclass=group))
Group Membership Searching= <select> limited
Max Group Membership Search Level=3
Static Group DNs from Member DN Filter=(&(member=%M)(objectclass=group))
Save

restart OEM with:
./emctl stop oms -all -force
./emctl start oms
This is what did it for us, hope it helps.

If not in your case…revert to Oracle Support or Google some more ūüėČ

Posted in Oracle Enterprise Manager, Technical Stuff | Tagged , | Leave a comment

Configure NetBackup For Oracle RAC..Or..”Back Me Up!”

When configuring Netbackup to backup a RAC database, we ran into the following error:

1/29/2016 3:28:02 PM - Info bphdb(pid=2717) INF - Database status is: SHUTDOWN
1/29/2016 3:28:02 PM - Info bphdb(pid=2717) INF - Database open mode is: NOT MOUNTED
1/29/2016 3:28:02 PM - Info bphdb(pid=2717) INF - ARCHIVE LOG mode is: UNKNOWN
1/29/2016 3:28:12 PM - Error bpbrm(pid=13636) from client <servername>: ERR - Script exited with status = -5407 <Database is in the wrong state (must be OPEN) for the requested action>
1/29/2016 3:28:12 PM - Error bpbrm(pid=13636) from client <servername>: ERR - bphdb exit status = 5407: Database is in the wrong state (must be OPEN) for the requested action
1/29/2016 3:28:14 PM - Info bphdb(pid=2717) done. status: 5407: Database is in the wrong state (must be OPEN) for the requested action
1/29/2016 3:28:14 PM - end writing
Database is in the wrong state (must be OPEN) for the requested action(5407)

In Netbackup the node was automagically picked up by the Netbackup client, which reads the /etc/oratab. In the oratab this database was known by it’s SCAN name. However when trying to connect, the connection to the node is random due to the nature of RAC. When the backup starts, the check is failing, resulting in a somewhat wrong error message of the client.

Now the question is: how to fix this?

Delete all the references in Netbackup of this database (to avoid confusion, since the listing of the /etc/oratab will be propagated again by the client to the server in due time).

Make sure the node/instance name is NOT in the /etc/oratab.

+ASM:/oracle/11.2.0.4/grid:N # line added by Agent
dummydb0:/oracle/11.2.0.4/base/db/dbhome_1:N # line added by Agent

In this case: the instance is dummydb01, the SCAN name is dummydb0.

In Netbackup:

sshot01.png

Add the instance MANUALLY by providing the information above. Make sure to provide the credentials.

sshot02.png

sshot03.png

On the oracle database server:

Make sure the added INSTANCE is reachable by adding this to the listener.ora.

$ vi listener.ora

SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=dummy01)
(SID_NAME=dummydb01)
(ORACLE_HOME=/oracle/11.2.0.4/base/db/dbhome_1)
)
)

$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 29-FEB-2016 12:11:38

Copyright (c) 1991, 2013, Oracle. All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 12-OCT-2015 02:51:52
Uptime 140 days 10 hr. 19 min. 45 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/11.2.0.4/grid/network/admin/listener.ora
Listener Log File /oracle/base/diag/tnslsnr/<servername>/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=xx.xx.xx.xx)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=xx.xx.xx.xx)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM", status READY, has 1 handler(s) for this service...
Instance "dummydb01", status READY, has 1 handler(s) for this service...
The command completed successfully

Configure the RMAN settings:

RMAN> show all;

using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name DUMMYDB0 are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEFAULT DEVICE TYPE TO 'SBT_TAPE';
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE 'SBT_TAPE' TO '%F';
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE SBT_TAPE PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE 'SBT_TAPE' TO 1;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE 'SBT_TAPE' TO 1;
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO BACKED UP 1 TIMES TO 'SBT_TAPE';

Make sure the settings in bold are set.

The PARALLELISM is set to 1, further testing should show if the backups are faster by a higher number. For now we just want to get this proces to work.

For testing purposes, create a manual backup in netbackup. When this is finished, this backup is visible in RMAN:

RMAN> list backup summary;
<..>
6545 B 0 A SBT_TAPE 29-FEB-16 1 1 NO TAG20160229T115522
6546 B F A SBT_TAPE 29-FEB-16 1 1 NO TAG20160229T141956
6547 B A A SBT_TAPE 29-FEB-16 1 1 NO TAG20160229T142121
6548 B F A SBT_TAPE 29-FEB-16 1 1 NO TAG20160229T142157
6549 B F A SBT_TAPE 29-FEB-16 1 1 NO TAG20160229T142314
6550 B F A SBT_TAPE 29-FEB-16 1 1 NO TAG20160229T142351

RMAN>

Validate the backup (from the “tape”):

RMAN> run {
allocate channel t1 type 'SBT_TAPE' parms 'ENV=(NB_ORA_CLIENT=<nodeName),SBT_LIBRARY=/usr/openv/netbackup/bin/libobk.so64';
send 'NB_ORA_SERV=<netbackup_server>,NB_ORA_CLIENT=<nodeName>';
restore database validate;
release channel t1;
}

using target database control file instead of recovery catalog
allocated channel: t1
channel t1: SID=606 instance=dummbydb01 device type=SBT_TAPE
channel t1: Veritas NetBackup for Oracle - Release 7.6 (2013111313)

sent command to channel: t1

Starting restore at 29-FEB-16

channel t1: starting validation of datafile backup set
channel t1: reading from backup piece bk_dDUMMYDB01_u9sqv4u1b_s8508_p1_t905082923

For more information about restoring, see the other post on my blog!

Posted in Databases | Tagged , , | Leave a comment

Java, SSHJ and EDDSA..Or…”Where Did I Left My Keys?”

For a long time I kept putting Oracle Database related posts, but as one can see in my profile, I also love to dabble with Java programming..While developing a custom way of getting an alert for a specific purpose (OEM let me down and I decided to have one created completely customized to my environment and because I love to program in my spare (oh, trust me, it’s SPARE) time..

Long story short: I needed ssh access to a machine (with Java) and chose to use sshj instead of the jsch with I have more experience with. but is kind of…outdated? Don’t get me wrong, it still does what’s advertised, but it’s documentation is kind of sparse to say the least..

After adding sshj-0.15.0.jar (along with the supporting libs) to my build-path I gave my litte setup a spin..

Supporting libs:
– slf4j-simple-1.7.14.jar
– slf4j-api-1.7.14.jar- bcprov-jdk15on-154.jar (optional)

and she-bang it went….

[main] INFO net.schmizz.sshj.common.SecurityUtils – BouncyCastle registration succeeded
Exception in thread “main” java.lang.NoClassDefFoundError: net/i2p/crypto/eddsa/spec/EdDSAParameterSpec
at net.schmizz.sshj.common.KeyType.<clinit>(KeyType.java:176)
at net.schmizz.sshj.transport.verification.OpenSSHKnownHosts$EntryFactory.parseEntry(OpenSSHKnownHosts.java:210)
at net.schmizz.sshj.transport.verification.OpenSSHKnownHosts.<init>(OpenSSHKnownHosts.java:69)
at net.schmizz.sshj.SSHClient.loadKnownHosts(SSHClient.java:616)
at net.schmizz.sshj.SSHClient.loadKnownHosts(SSHClient.java:596)
at org.blackbox.JTableSpaceCheck.units.remote.RemoteConnect.getTNSNames(RemoteConnect.java:31)
at org.blackbox.JTableSpaceCheck.JTableSpaceCheck.main(JTableSpaceCheck.java:21)
Caused by: java.lang.ClassNotFoundException: net.i2p.crypto.eddsa.spec.EdDSAParameterSpec
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
… 7 more

I googled and googled, and although I did found the site with some java classes with the EDDSA encryption, and also found out, this was some encryption schema, I did not find the JAR file I could slam onto my project. Sure, I could download some source from a GITHUB site, and create a JAR myself, I would probably keep running in the missing ‘EdDSAParameterSpec’ file..since I couldn’t find this.

Until I found this site: I2P

On this site it is not really apparent, but, yes, the JAR file we (since you stumbled on this page) are looking for is hidden..

Download the package i2pinstall_0.9.24.jar (based on the platform of choice, I choose linux since I develop on this platform) and follow the instructions to “install” this file. I choose the graphical version, and unpacked the goodies in my homedir in a tmp folder.

Selection_002.png

After the installation (unpacking is more apt) the folder <install_loc>/i2p is created, and within this the folder lib. Navigate to this folder, and lo and behold: there is a JAR file called: i2p.jar.

This file is the one we need/want: it contains the EDDSA classes, including the spec file. Copy this file into the classpath to build the app, and the pesky errorstack will be gone!

It took me some searching, and since Google didn’t help me out in the speedy way it normally does, I hope to contribute in some small way to help you out..

Happy coding!

Posted in Java, Technical Stuff | Tagged , , | 2 Comments

Duplicate Controlfile To FRA (ASM)..Or..’Make It A Double!’

In a previous post we restored a database which was accidentally (a-hum) dropped from a Netbackup. In this procedure we focused on the restore, but this left us with a database running on only one control file. This is so called: not-best-practice, and since I was the one leaving the reader (yes, that would be you) with a potential dangerous situation, this post is created to remedy this.

Log into the database as sys and check the current status of the control file:

SQL> select name from v$controlfile;

NAME
--------------------------------------------------------------------------------
+DATADG/dummydb01/controlfile/current.309.901542237

SQL>

Yep. It’s for real…we are running on just one controlfile. Not good. Time to fix.

Note: Make sure you are running with a spfile. If not, start from a running instance and create one from memory and bounce and start from the spfile.

 

SQL> alter system set control_files='+DATADG/dummydb01/controlfile/current.309.901542237','+FRADG' scope=spfile;

SQL> shutdown immediate;

SQL> startup nomount;

This is needed since we defined a location (FRA) where no controlfile is yet to be found. Hence the database will not start.

Now connect RMAN to the database:

$ rlwrap rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Tue Jan 19 14:07:56 2016

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: DUMMYDB01 (not mounted)

RMAN> restore controlfile from '+DATADG/dummydb01/controlfile/current.309.901542237';

Starting restore at 19-JAN-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=926 device type=DISK

channel ORA_DISK_1: copied control file copy
output file name=+DATADG/dummydb01/controlfile/current.309.901542237
output file name=+FRADG/dummydb01/controlfile/current.1590.901548509
Finished restore at 19-JAN-16

Exit RMAN, and connect with SQL (as sys):

SQL> alter system set control_files='+DATADG/dummydb01/controlfile/current.309.901542237','+FRADG/dummydb01/controlfile/current.1590.901548509';

SQL> shutdown immediate;

SQL> startup;

SQL> startup
ORACLE instance started.
Total System Global Area 1.0689E+10 bytes
Fixed Size                  2262656 bytes
Variable Size            3690989952 bytes
Database Buffers         6979321856 bytes
Redo Buffers               16900096 bytes
Database mounted.
Database opened.

Double check (since the startup confirms it already) the control_files:

SQL> select name from v$controlfile;

NAME
--------------------------------------------------------------------------------
+DATADG/dummydb01/controlfile/current.309.901542237
+FRADG/dummydb01/controlfile/current.1590.901548509

SQL>exit.

And this is one of the ways of doing this.

 

Posted in Databases, Technical Stuff | Tagged , | Leave a comment