Perl Scripts

Script to migrate data from FileMaker Pro to Oracle

use strict; use DBI qw(:sql_types); my $db_connect_string_oracle = ‘contact_management_ora_dsn’; my $db_connect_string_fmpro = ‘contact_management_fmp_dsn’; my $filemaker_database_name = ‘contact_management’; my $oracle_tablename = ‘contact_management’; my $schema_name = ‘user1’; my $schema_password = ‘user1pwd’; my $debug=0; # DBI tracing enable/disable my $long_readlength = 100000; # maximum number of bytes for CLOB, BLOB type data read from FileMaker – inscrease this…

Load Oracle NameServer from TNSNAMES.ORA file

$TNSNAMES = “./tnsnames.ora”; @NAMESERVERS = (oranamesrvr0,oranamesrvr1,oranamesrvr2); foreach $NS (@NAMESERVERS) { print “\nset server ” . $NS . “\n\n”; &register_name_servers; &load_tnsnames; } print “\n\nexit\n”; exit; #————————————————————————– sub register_name_servers { # # Register all NameServers. The defualt port is 1575. # print “register oranamesrvr0.world -t ORACLE_NAMESERVER -d ” . “(ADDRESS=(PROTOCOL=TCP)(HOST=oranamesrvr0)(PORT=1575))\n\n”; print “register oranamesrvr1.world -t ORACLE_NAMESERVER -d “…

Oracle Alert Log Monitor

=head1 NAME trlogmon – Oracle alert log monitor =head1 SYNOPSIS trlogmon.p [-sleep ] =head1 DESCRIPTION Monitors the Oracle instance alert log for problems (i.e. ORA-00600, block corruption errors, etc). The log file is monitored in a manner similar to the B command, using the ‘-f’ switch. This is done by resetting the error flag on…

Simple script for checking log switches

format top = LOG SWITCH REPORT +++++++++++++++++ Time Sequence __________________ _____________ . format STDOUT = @

Oracle Log Switch Analyzer

use strict; use Getopt::Long; use Date::Manip; my($result) = Getopt::Long::GetOptions( “instance:s”, “lines-per-page:i” , “filename:s”, “ignore:i”, “help”, “debug!” ); $main::opt_help = $main::opt_help; if ( ( ! $main::opt_instance && ! $main::opt_filename ) || ( $main::opt_instance && $main::opt_filename ) || $main::opt_help ) { &usage; exit 1; } my $logFile; if ( $main::opt_filename ) { $logFile = $main::opt_filename } else…

Inserts or retrieves a BLOB from an Oracle database

use DBI; ## Parameters $doDebug = 0; $| = 1; # set stdout to flush $LONG_RAW_TYPE=24; # Oracle type id for blobs # Get args ($operation, $connectString, $sqlStmt, $blobFileName) = @ARGV; # Check args if ( (($operation ne “-select”) && ($operation ne “-insert”)) || (($operation eq “-insert”) && (! “$blobFileName”)) || (($operation eq “-insert”) &&…

OERR command for Windows

if ($#ARGV!=1) { print “Usage: oerr facility errornumber where facility is case-insensitive and not limited to ORA Please open oerr.pl with a text editor and modify \$dir if you haven’t done so Example: oerr ora 18\n”; exit 1; } #Files HREFed on all lines that contain 5 consecutive digits will be searched. #However, some error…