Friday, February 25, 2011

Oracle 11g DBConsole Creation

After the installation of Oracle 11g Database, DBConsole can be configured manually.

Before the configurations make sure that it is not configured and this can be verified by checking the services list or by hitting the command emctl dbconsole status or by hitting the url https://ServerIP:1158/em / https://ServerIP:5500/em

emca -config dbcontrol db -repos [create|recreate]
with this command we can create the DBConsole service, this will ask the parameters like HostName, ORACLE_HOME, DatabaseName, Passwords for accounts like SYS, SYSMAN, DBSNMP, SMTP Params.

Saturday, January 1, 2011

Installing PERL Script(Linux/Win) for Snort-MySQL Database Cleanup.

MySQL-Snort-Cleanup.pl is very simple and useful perl script with which we can manage cleanup activity for IDS Database SNORT, This will delete the data from all the respective tables, we have to provide the command line arguments to this script i.e. StartDate and EndDate

For windows OS we need to install the Active Perl, and mysql db drivers, Once it is done we can run this MySQL-Snort-Cleanup.pl for cleaning database with specific time frames. Database Name,UserName, Passwords to be supplied to the MySQL-Snort-Cleanup.pl can be modified by any text editor.

Script Usage for Win/Linux:-
perl MySQL-Snort-Cleanup.pl "Start Time" "End Time"
e.g. perl MySQL-Snort-Cleanup.pl "2010-12-18 15:00:00" "2010-12-18 16:07:00"

Active Perl installation is not installing the DB drivers for MySQL DB by default hence same must be installed using Perl Package Manager(PPM) It is defined below.









1).Active Perl Installation with the default settings for windows. (for linux it is installed by default
2).MySQL driver can be installed on windows using PPM as shown below.
  
ppm install DBD-mysql






Perl Script MySQL-Snort-Cleanup.pl



MySQL Database Exporting/Importing

we can use Perl scripts to automate the MySQL database in connection with the mysqldump utility specially for large databases.
mysqldump -u UserName -pPassword DBName | gzip > DBName.sql.gz
Once the DatabaseName.sql.gz is completed the same file can be imported to the new created database but gz file needs to be decompressed first it can be done as shown below.
gzip -d DatabaseName.sql.gz


Database Restoring Steps.
Create new Database
Connect to the newly created database
Import the decompressed/extracted file DatabaseName.sql using below option
Create database NewDBName
Connect NewDBName
source D:\DatabaseName.sql


This will import the entire sql dump file to this new database.