Save Linux terminal session (script)

During daily work, sometimes we perform tasks that we would like to document properly.entrada Linux script

In this post we will see how to save an entire Linux terminal session, so that we can subsequently include any documentation.

The command we use is:

script

Continue reading

MySQL jobs, scheduling tasks

This time we will see how to perform a scheduled task in MySQL (relatively speaking a job Oracle).

First we have to make sure we have the scheduler started with this we see:

Source   
mysql> SHOW processlist;
+----+------+-----------------+------------+---------+------+-------+------------------+
| Id | User | Host            | db         | Command | Time | State | Info             |
+----+------+-----------------+------------+---------+------+-------+------------------+
|  6 | root | localhost:49987 | assets_pru | Sleep   |  299 |       | NULL             |
|  8 | root | localhost       | assets_pru | Query   |    0 | NULL  | SHOW processlist |
+----+------+-----------------+------------+---------+------+-------+------------------+
2 rows IN SET (0.00 sec)

It is not started, for this we have to change a parameter of the mysqld section in my.cnf:

Continue reading

iptables ddos configuring recent, prevent denial of service attacks (DOS Denial Of Service) Linux (Match recent extension)

Recently has contacted me a companion called Miguel Angel (greetings) to see if he could help out with attacks that are suffering. Obviously I will not use your data for anything in this entry.

In this post we will make a more accurate filtering of incoming communications, to prevent DOS attacks.

In the previous post “iptables ddos limit configuration, prevent denial of service attacks on Linux (Match extension limit)” is shown as filter limiting the number of hits. The great improvement in recent vs limit extension is that recent maintains a list of source IPs communication and limits are set by source IP. The limits imposed limit extension regardless of origin, is an overall limit.

 

Continue reading

RMAN parameters, in scripts (only Oracle 11g or later)

When we make a list of the backups made with:

Source   
RMAN> list backup summary;

For example, we may have problems locating a backupset. The result is quite confusing and certainly inelegant labels are created by default.

Continue reading

Oracle search string in database

In some cases, fortunately not too many, I had to search for a string (usually something related to configuration) in a schema of the database.

Gets complicated when there is a huge amount of tables and also no way to contact the developer, is as hell.

Well good for these cases I want to share a PL / SQL script homegrown (as almost everyone who put in the blog), which facilitates the issue fairly:

Continue reading

RMAN restore backup, from tape to another server

A good exercise to verify that a backups made it correctly, is prepare a script that does a restoring on demand to another server (frequently in preproducction environment)

I tell a restoring and not a clone (something really amazing that you can clone a DB without stop it until current time), because the cloned needs the origin DB (surely production) has to remain in open state and in case of disaster this is not the scenario.

The restoring show here was made without external RMAN catalog (is using only information of controlfile as catalog), this forces to have enable the option: Continue reading

Automatic start Oracle database linux RedHat

A small script to automatically start an Oracle DB:

Source   
# chkconfig: 2345 80 20
# description: Oracle Database
#!/bin/bash
start() {
su - oracle <<EOF
lsnrctl start
sqlplus / as sysdba<<EOO
startup
EOO
EOF
}
stop() {
su - oracle <<EOF
sqlplus / as sysdba<<EOO
shutdown immediate
EOO
lsnrctl stop
EOF
}
case "$1" in
start)
start
;;
stop)
stop
;;
*)
echo $"Usage: $0 {start|stop}"
esac

Start the database as “oracle” user, you have to have all correctemente configured environment variables.

You can install this script with chkconfig, because the head is prepared for this