scp – Secure Copy Command

Tuesday, November 28, 2006

About a year ago, I was forced to move away from using FTP and start using SCP (secure cp) to transfer files between our Linux servers. SCP is available on other UNIX systems and easy enough to use. Problem is I don’t use it often enough and forget the syntax when I need it.

Syntax to copy the file “mike.txt” from a remote host to the local host:

# scp username@remotehost_name:/path/mike.txt /local_dir

Example of copying file to current directory location:

# scp root@srvr02.domain.com:/d01/dbbackup/jiradb.bkp .

The authenticity of host ‘srvr02.domain.com (xxx.xx.xxx.xx)’ can’t be established.
RSA key fingerprint is <hexadecimal_output>.

Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘srvr02.domain.com’ (RSA) to the list of known hosts.
root@srvr02.domain.com’s password:

jiradb.bkp 100% 51MB 1.8MB/s 00:28

Additional Information
WinSCP is an open source SFTP client for Windows.

Update (17-Sep-2009)
Additional SCP syntax information found here.

Update (29-Aug-2008)
SCP automation tip from Santhosh Tirunahari’s blog Think Beyond Technology.

Advertisements

Oracle10gR2 Alert E-Mail – Part 2

Thursday, November 16, 2006

I really did need to apply patch 5117076 based on the Oracle10gR2 Alert E-Mail. Just to refresh, this is a problem regarding the 10.2.0.2 RDBMS server patchset for Sun Sparc Solaris 64-bit. This post is a little long, but I have tried to include as much detail hoping it will save you from the frustration I encountered by not following the Alert E-Mail.

Onto the gory details. This is what my installation looked like prior to my exercise using “opatch lsinventory”.

Installed Top-level Products (2):

Oracle Database 10g 10.2.0.1.0
Oracle Database 10g Release 2 Patch Set 1 10.2.0.2.0
There are 2 products installed in this Oracle Home.

Interim patches (2) :

Patch 5458753 : applied on Fri Oct 20 15:52:49 CDT 2006
Created on 22 Sep 2006, 08:10:13 hrs PST8PDT
Bugs fixed:
5458753

Patch 5225799 : applied on Tue Jul 25 14:57:14 CDT 2006
Created on 17 Jul 2006, 05:37:39 hrs PST8PDT
Bugs fixed:
5092134, 5099995, 5242650, 5079037, 5079038, 4523125, 5225799, 4669305

I planned to rollback patch 5458753 first, then apply patch 5117016, and then re-apply patch 5458753. I would leave the CPUJul2006 patch (5225799) intact since I intended to apply the CPUOct2006 patch which will automatically rollback CPUJul2006.

My intention to leave CPUJul2006 intact could not be more wrong. Do not take shortcuts in this process. All interim patches must be removed before applying patch 5117016.

Started with the rollback of patch 5458753. That was successfully removed without a problem.

%> opatch rollback -id 5458753

Next, instead of removing patch 5225799 (CPUJul2006), I went on to apply patch 5117016. The patch installed successfully, but this is where my mistake began. All interim patches must be removed prior to installing patch 5117016.

%> cd 5117016
%> opatch apply

Mistakenly, I proceeded by applying patch 5458753 which also installed successfully.

%> cd 5458753
%> opatch apply

Finally, I attempted to install the CPUOct2006 patch (5490848). As expected, this patch removed the CPUJul2006 patch by default. Everything looks okay until the relink phase.

Running make for target ioracle
Make failed to invoke “/usr/ccs/bin/make -f ins_rdbms.mk ioracle ORACLE_HOME=/disk01/app/oracle/product/10.2.0/db_1″….
‘Undefined first referenced symbol in file ksqgel /disk01/app/oracle/product/10.2.0/db_1/lib/
/libserver10.a(kkzf.o)
ld: fatal: Symbol referencing errors. No output written
/disk01/app/oracle/product/10.2.0/db_1/rdbms/lib/oracle
make: Fatal error: Command failed for target `/disk01/app/oracle/product/10.2.0/db_1/rdbms/lib/oracle’

Searched Metalink using “libserver10.a(kkzf.o)” and found Note 396649.1 which outlines three solutions to resolve the problem. I chose option #3.

OPTION 3: Extracting libserver10.a from the 10.2.0.2 Patchset

1. Rollback ALL Interim patches installed

2. Extract libserver10.a from 10.2.0.2 patchset staging area

% cd /tmp
% jar xvf <10.2.0.2 patchset staging area>
/Disk1/stage/Patches/oracle.rdbms/10.2.0.2.0/1
/DataFiles/filegroup14.1.1.jar libserver10.a

3. Backup original

% mv $ORACLE_HOME/lib/libserver10.a $ORACLE_HOME/lib/libserver10.a.bad

4. Move extracted libserver10.a to correct location

% mv libserver10.a $ORACLE_HOME/lib/libserver10.a

5. Relink

% relink all

You can now reinstall any Interim patch that your installation requires

This is a snapshot of where I was before beginning the interim patch rollbacks.

Installed Top-level Products (2):

Oracle Database 10g 10.2.0.1.0
Oracle Database 10g Release 2 Patch Set 1 10.2.0.2.0
There are 2 products installed in this Oracle Home.

Interim patches (3) :

Patch 5458753 : applied on Wed Nov 15 14:24:10 CST 2006
Created on 22 Sep 2006, 08:10:13 hrs PST8PDT
Bugs fixed:
5458753

Patch 5117016 : applied on Wed Nov 15 14:19:41 CST 2006
Created on 30 Mar 2006, 12:52:17 hrs US/Pacific
Bugs fixed:
5117016

Patch 5225799 : applied on Tue Jul 25 14:57:14 CDT 2006
Created on 17 Jul 2006, 05:37:39 hrs PST8PDT
Bugs fixed:
5092134, 5099995, 5242650, 5079037, 5079038, 4523125, 5225799, 4669305

Began to rollback the interim patches as specified in Step #1. Rolled back in this order

opatch rollback -id 5458753
opatch rollback -id 5117016
opatch rollback -id 5225799

Finally, all patches removed.

Installed Top-level Products (2):

Oracle Database 10g 10.2.0.1.0
Oracle Database 10g Release 2 Patch Set 1 10.2.0.2.0
There are 2 products installed in this Oracle Home.

There are no Interim patches installed in this Oracle Home.

Followed Steps #2 thru #5 and then applied all the patches again in the correct order.

1. Patch 5117016
2. Patch 5458753
3. Patch 5225799

Finally got back to where I needed to be prior to the mess I created. Unfortunately, I did not install CPUOct2006 because my maintenance window elapsed. Had I followed directions from the beginning, I would have avoided this situation. Now I have to schedule another time to apply CPUOct2006.

Installed Top-level Products (2):

Oracle Database 10g 10.2.0.1.0
Oracle Database 10g Release 2 Patch Set 1 10.2.0.2.0
There are 2 products installed in this Oracle Home.

Interim patches (3) :

Patch 5225799 : applied on Wed Nov 15 15:54:05 CST 2006
Created on 17 Jul 2006, 05:37:39 hrs PST8PDT
Bugs fixed:
5092134, 5099995, 5242650, 5079037, 5079038, 4523125, 5225799, 4669305

Patch 5458753 : applied on Wed Nov 15 15:50:21 CST 2006
Created on 22 Sep 2006, 08:10:13 hrs PST8PDT
Bugs fixed:
5458753

Patch 5117016 : applied on Wed Nov 15 15:48:22 CST 2006
Created on 30 Mar 2006, 12:52:17 hrs US/Pacific
Bugs fixed:
5117016


control_file_record_keep_time

Monday, November 6, 2006

One of my production databases running 9.2.0.8 was generating an excessive amount of redo information to the point where the redo logs were switching every 4 to 5 minutes for more than 12 hours. Each redo log group is 100MB in size. Originally sized this way so as to log switch every 30 to 45 minutes with normal activity. Found the information below in the alert log during my research.

kccrsz: expanded controlfile section 11 from 601 to 615 records requested to grow by 6 record(s); added 1 block(s) of records

Went to Metalink for additional information on this message which eventually lead me to the CONTROL_FILE_RECORD_KEEP_TIME parameter. This initialization parameter determines the minimum number of days that records are retained in the control file before they are candidates for being overwritten. You can dynamically adjust the setting as shown below.

ALTER SYSTEM SET control_file_record_keep_time=3;

Went to Google and found information about automatic controlfile resizing from Steve Adams.

Setting this parameter appropriately in relation to the frequency of your database backups is significant in order to ensure smooth recovery. Searched AskTom.com where I found these two paragraphs as valuable information.

“If you are using RMAN with just the control file and no recovery catalog, it’ll totally depend on how fast you cycle through and reuse reusable records in the control file. In any case — you can always recover manually regardless (you do not lose the ability to recover, we just might not be able to supply you the filenames).”

“Set your control_file_record_keep_time to be at least one day GREATER then the period of time between your backups, else there is a chance that an archive record gets aged out during the backup which thoroughly confuses the situation.”


SQL Server 2005 Virtual Labs

Sunday, November 5, 2006

Received my November 2006 issue of SQL Server Magazine yesterday. One of the articles mentioned Virtual Labs for SQL Server 2005 which allow you to run through 17 specific SQL Server 2005 modules. Each module is designed to be completed in 90 minutes. These labs are virtual machines (VMs) accessible over the Internet and relieve you of the time and effort to setup the hardware and software.

I believe hardware and software setup is usually an important part of the learning process, however in my case I will be happy with just understanding the content these modules have to offer due to the limited amount of time I have to dedicate. Since SQL Server is not my primary focus on a daily frequency, Oracle is, the virtual labs will more than suffice.


Oracle9i JDBC – Connection refused

Thursday, November 2, 2006

I call a Java program in Nagios to test if my database is responding. It is required to test the JDBC connection. The Java program accepts four command line arguments: user, password, hostname, and database.

JdbcThinCheckup mike mike xxx.xx.xx.xxx niku

Added a new service to Nagios to check a database and was getting the error below.

Error: Io exception: Connection refused (DESCRIPTION=(TMP=)(VSNNUM=153094144)(ERR=12505)
(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))))

Turns out I was using the alias “nikuprod” found in the tnsnames.ora file rather than the database name “niku”. JDBC doesn’t utilize the tnsnames.ora file. Not sure why that didn’t occur to me yesterday. Brain fart maybe?

NIKUPROD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS=(PROTOCOL=TCP)(HOST=myhost)(PORT=1521))
)
(CONNECT_DATA =
(SERVICE_NAME = NIKU)
)
)

Wasted some time trying to resolve this error by not paying attention. At least I’ll be able to refer back to my blog entry when this happens again a year from now.