viernes, 14 de octubre de 2011
archivo temporal de CRON en suse linux 10
/tmp/
En este archivo guarda lo que existia antes de editar y guardar nuevamente los cambios nuevamente en el cron
crontab.XXXXoYwoUe
al dar un "more" o "cat" al archivo crontab.XXXXoYwoUe se prodra visualizar lo que contenia antes del ultimo grabado
domingo, 9 de octubre de 2011
Activar auditoría de una base de datos oracle 10g
Se pretende mediante un sencillo ejemplo práctico para ver cómo se puede auditarlas conexiónes a una base de datos ORACLE o auditar los intentos de modificación a las tablas de un usuario.
Teniendo en cuenta que el parámetro que habilita la posibilidad de auditar la base de datos ORACLE en el init.ora es audit_trail que el comando sql que activa la auditoría sobre algo es AUDIT ( para desactivar NOAUDIT ) y que la tabla para mirar ( usuario sys ) el seguimiento de auditoría es dba_audit_trail vamos a realizar este sencillo ejemplo.
- Activar la auditoria de intento de conexiones fallidas para todos los usuarios.
Miramos que actualmente no está activada la auditoria en la base de datos
SQL> select name , value from v$parameter where name like ‘audit_trail’;
audit_trail NONE
Activamos la auditoría de la base de datos
SQL> alter system set audit_trail = DB scope = spfile;
Reiniciamos la base de datos ( shutdown immediate, startup ) y comprobamos que la auditoría se ha activado.
SQL> select name , value from v$parameter where name like ‘audit_trail’;
audit_trail DB
Activamos la auditoría para ver la conexión y desconexión de los usuarios a la base de datos, se hace con la siguiente sentencia
SQL> audit connect;
SE REINICIA LA BASE DE DATOS
- Visualizar las tablas de auditoría para comprobar que se insertan datos cuando intentamos conectarnos sin lograrlo.
En el apartado anterior hemos activado la auditoría para ver como se conectan los usuarios a la base de datos, vamos a realizar varias pruebas y mostrar dónde se puede comprobar que los usuarios se han conectado a la base de datos.
Nos conectamos con varios usuarios a la base de datos ( en nuestro caso con system y el usuario user9 que está creado )
SQL> connect user9/user9;
SQL> connect system/system;
Tras habernos conectado a la base de datos miramos la tabladba_audit_trail para ver que datos contiene.
SQL> select username , action_name , priv_used , returncode from dba_audit_trail ;
“SYSTEM” “LOGON” 1017
“SYSTEM” “LOGON” 1017
“USER9″ “LOGON” 1017
“USER9″ “LOGON” “CREATE SESSION” 0
“USER9″ “LOGON” 1017
“USER9″ “LOGON” 1017
Observarmos que en esta tabla se registran los intentos de conexión de los usuarios, por lo tanto podemos saber quien se ha conectado a la base de datos
- Activar la auditoria sobre la modificación de tablas del usuario Scott.
Ahora vamos a activar la auditoría sobre la modificación de las tablas sobre el usuario Scott, de esta forma cualquier modificación realizada en una tabla que pertenezca a este usuario será registrada en las tablas y podremos ver quien ha realizado esa modifiación.
SQL>audit insert,update on scott . bonus by access;
SQL>audit insert,update on scott . emp by access;
SQL>audit insert,update on scott .dept by access;
SQL>audit insert,update on scott . salgrade by access;
En este caso estamos auditando cada una de las tablas que pertenencen al usuario scott ( bonus, emp, dept, salgrade ) en caso de que alguien inserte algo en ellas o realice alguna actualización. ( si queremos auditar el borrado o la lectura de alguna fila, solo hay que añadir los permisos de select y delete detrás del comando audit).Al ponerlo by access se guardará un registro en la tabla de auditoría por cada intento de insert o update que se realice sobre cada una de las tablas nombradas. ( exite también el registro by session, en el cual se registra por sesión única el intento de insert o update sobre las tablas ).
Miramos la tabla user_obj_audit_opts ( con el usuario scott )
SQL>select * from user_obj_audit_opts;
“BONUS” “TABLE” “-/-” “-/-” “-/-” “-/-” “-/-” “-/-” “A/A” “-/-” “-/-” “-/-” “A/A” “-/-” “-/-” “-/-” “-/-” “-/-”
“DEPT” “TABLE” “-/-” “-/-” “-/-” “-/-” “-/-” “-/-” “A/A” “-/-” “-/-” “-/-” “A/A” “-/-” “-/-” “-/-” “-/-” “-/-”
“EMP” “TABLE” “-/-” “-/-” “-/-” “-/-” “-/-” “-/-” “A/A” “-/-” “-/-” “-/-” “A/A” “-/-” “-/-” “-/-” “-/-” “-/-”
“SALGRADE” “TABLE” “-/-” “-/-” “-/-” “-/-” “-/-” “-/-” “A/A” “-/-” “-/-” “-/-” “A/A” “-/-” “-/-” “-/-” “-/-” “-/-”
Y observamos que es lo que estamos auditando del usuario scott, en este caso se vería que eta activada para cada una de las tablas la auditoría para update e insert.
(A/A) –> activado / por acceso
La prueba que se puede realizar es conectarse con otro usuario que tenga permisos de insert y update sobre estas tablas y realizar una serie de inserciones y actualizaciones en esas tablas. En este caso suponemos que un usuario, user9 que tiene permisos de inserción y actualización sobre las tablas del usuario scott ha realizado una serie de inserciones y actualizaciones sobre estas tablas. La forma de ver si las ha realizado o no ( teniendo activada la auditoría es la siguiente ).
SQL>select * from sys . dba_audit_trail where ( action_name = ‘INSERT’ ) or ( action_name = ‘UPDATE’ ) ;
El resultado es el siguiente:
“ERIN-0S2WXM4BDG\Erin” “USER9″ “ERIN-0S2WXM4BDG” 19/04/2006 15:38:56 “SCOTT” “BONUS” 2 “INSERT” 267 2 47 0
“ERIN-0S2WXM4BDG\Erin” “USER9″ “ERIN-0S2WXM4BDG” 19/04/2006 15:39:09 “SCOTT” “BONUS” 2 “INSERT” 267 3 50 0
“ERIN-0S2WXM4BDG\Erin” “USER9″ “ERIN-0S2WXM4BDG” 19/04/2006 15:39:19 “SCOTT” “BONUS” 6 “UPDATE” 267 4 55 0
Observamos que se han registrado los intentos de inserción y de modificación sobre la tabla BONU
martes, 4 de octubre de 2011
CAMBIAR TAMAÑO DE REDOLOG EN ORACLE 10G Y 11G
ESTOS PASOS SE APLICARON PARA VERSION DE BASE DE DATOS ORACLE 10 Y 11G
link en los que me base
http://nelsonjaviermartinezacosta.blogspot.com/2009/07/aumentar-tamano-redologs.html
http://eskernel.blogspot.com/2009/07/redolog-files.html
link para leer version 7.3.2
http://www.infor.uva.es/~jvegas/cursos/bd/orarq/orarq.html
--comando para ver la ruta donde estan los archivos redolog
select * from v$logfile;
/ruta_fisica_del_archivo/
--comando para ver sobre que redo log esta trabajando la base y ver el redolog INACTIVO que es el que se puede eliminar para volver a utilizar y redimenxionar y no agregar mas redolog
select group#, bytes, status from v$log
--comando para hacer un checkpoint y cambiar de redo log
alter system switch logfile;
--Se preparo las sentencias que se van a plicar en el momento adecuado dependiendo el el moento que este INACTIVO el redo log
alter database drop logfile group 1;
alter database add logfile group 1 ('/ruta_fisica_del_archivo/redo01.log') size 200m reuse;
alter database drop logfile group 2;
alter database add logfile group 2 ('/ruta_fisica_del_archivo/redo02.log') size 200m reuse;
alter database drop logfile group 3;
alter database add logfile group 3 ('/ruta_fisica_del_archivo/redo03.log') size 200m reuse;
$ sqlplus / as sysdba
SQL*Plus: Release 10.1.0.2.0 - Production on Mar Oct 4 03:24:25 2011
Copyright (c) 1982, 2004, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Release 10.1.0.2.0 - 64bit Production
SQL> select group#, bytes, status from v$log;
GROUP# BYTES STATUS
---------- ---------- ----------------
1 10485760 CURRENT
2 10485760 INACTIVE
3 10485760 INACTIVE
SQL> alter database drop logfile group 2;
Database altered.
SQL> alter database add logfile group 2 ('/ruta_fisica_del_archivo/redo02.log') size 200m reuse;
Database altered.
SQL> select group#, bytes, status from v$log;
GROUP# BYTES STATUS
---------- ---------- ----------------
1 10485760 CURRENT
2 209715200 UNUSED
3 10485760 INACTIVE
SQL> alter system switch logfile;
System altered.
SQL> select group#, bytes, status from v$log;
GROUP# BYTES STATUS
---------- ---------- ----------------
1 10485760 ACTIVE
2 209715200 CURRENT
3 10485760 INACTIVE
SQL> alter database drop logfile group 3;
Database altered.
SQL> alter database add logfile group 3 ('/ruta_fisica_del_archivo/redo03.log') size 200m reuse;
Database altered.
SQL> select group#, bytes, status from v$log;
GROUP# BYTES STATUS
---------- ---------- ----------------
1 10485760 ACTIVE
2 209715200 CURRENT
3 209715200 UNUSED
SQL> alter system switch logfile;
System altered.
SQL> select group#, bytes, status from v$log;
GROUP# BYTES STATUS
---------- ---------- ----------------
1 10485760 INACTIVE
2 209715200 ACTIVE
3 209715200 CURRENT
SQL> alter database drop logfile group 1;
Database altered.
SQL> alter database add logfile group 1 ('/ruta_fisica_del_archivo/redo01.log') size 200m reuse;
Database altered.
SQL> select group#, bytes, status from v$log;
GROUP# BYTES STATUS
---------- ---------- ----------------
1 209715200 UNUSED
2 209715200 ACTIVE
3 209715200 CURRENT
SQL> alter system switch logfile;
System altered.
SQL> select group#, bytes, status from v$log;
GROUP# BYTES STATUS
---------- ---------- ----------------
1 209715200 CURRENT
2 209715200 INACTIVE
3 209715200 ACTIVE
lunes, 26 de septiembre de 2011
visualizar los ficheros PDF desde Chromium Utilizar “Evince”
Primero, instala mozplugger con:
$ sudo apt-get install mozplugger
Despues edita el fichero /etc/mozpluggerrc (con el usuario root o como sudo )y buscas y comentas la línea siguiente (añadiéndole un # delante):
Asi:
#define(ACROREAD, [repeat swallow(acroread) fill : acroread -openInNewWindow /a "$fragment" "$file"])
Seguidamente añadimos lo siguiente (todo en una sola línea):
Para justo a continuación escribir:
define(ACROREAD, [repeat swallow(evince) fill needs_xembed : evince "$file"])
Reinicias chromium y listo. le damos a cualquier archivo PDF abrir desde el explorador nautilus con Chrome y se puede imprimir, soluciona cuando no se puede imprimir con el visor de documentos PDF
viernes, 16 de septiembre de 2011
cambiar NLS_CHARACTERSET oracle 11g
[oracle@dbs]$ echo $LANG
es_ES.UTF-8
[oracle@dbs]$ locale
LANG=es_ES.UTF-8
LC_CTYPE="es_ES.UTF-8"
LC_NUMERIC="es_ES.UTF-8"
LC_TIME="es_ES.UTF-8"
LC_COLLATE="es_ES.UTF-8"
LC_MONETARY="es_ES.UTF-8"
LC_MESSAGES="es_ES.UTF-8"
LC_PAPER="es_ES.UTF-8"
LC_NAME="es_ES.UTF-8"
LC_ADDRESS="es_ES.UTF-8"
LC_TELEPHONE="es_ES.UTF-8"
LC_MEASUREMENT="es_ES.UTF-8"
LC_IDENTIFICATION="es_ES.UTF-8"
LC_ALL=
lo cambien siguiedo los consejos en http://linuxeros-faq.blogspot.com/2010/06/como-cambiar-el-idioma-en-sistemas.html para centos system-config-language u en forma grafica Sistema --> Administracion --> idiomas
2. Lo siguiente era cambiar el set de caracter ya que esta no pasaba la importacion de una base de datos en 9i
ERROR AL IMPORTAR LOS DATOS:
IMP-00019: row rejected due to ORACLE error 12899
IMP-00003: ORACLE error 12899 encountered
ORA-12899: el valor es demasiado grande para la columna "USUARIO"."TABLA"."CAMPO_NOMCTO" (real: 31, maximo: 30)
Column 1 304
Column 2 205732
Column 3 CAMPOS
Column 4 YA?EZ
Column 5 MARIA LUPE
Column 6 CAMPOS YA?EZ MARIA LUPE
parametro que tenia en archivo init*.ora en la base oracle 11g
*.nls_language='SPANISH'
*.nls_territory='SPAIN'
lo cambien a
*.nls_language='MEXICAN SPANISH'
*.nls_territory='MEXICO'
Baje la base lo subi y no funciona la importacion de datos
Opte por cambiar variables de ambiente
La exportacion de datos del dmp se hace con la varaible al valor:
export NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1;
y se intento importar de esta forma y tambien de export NLS_LANG=SPANISH_SPAIN.WE8ISO8859P1 dando el mismo error de importacion de datos
Verifique juego de caracteres en ambas bases 9i y 11g
Juego de caracteres en ORACLE 9I
dbnorte/ oracle@itanium_:~$ sqlplus /nolog
SQL*Plus: Release 9.2.0.5.0 - Production on Vie Sep 16 12:54:17 2011
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
SQL> connect / as sysdba
Connected.
SQL> select value from nls_database_parameters where parameter = 'NLS_CHARACTERSET';
VALUE
----------------------------------------
WE8PC850
Juego de caracter en base oracle 11g
SQL> select value from nls_database_parameters where parameter = 'NLS_CHARACTERSET';
VALUE
---------------------------------------------------------
AL32UTF8
se siguieron los pasos que estan en el link
http://oracle.ittoolbox.com/groups/technical-functional/oracle-db-l/changing-character-set-of-oracle-database-87376
en especial estos:
SQL> SHUTDOWN IMMEDIATE; -- or NORMAL
SQL> STARTUP MOUNT;
SQL> ALTER SYSTEM ENABLE RESTRICTED SESSION;
SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
SQL> ALTER DATABASE OPEN;
SQL> ALTER DATABASE CHARACTER SET
SQL> SHUTDOWN IMMEDIATE; -- or NORMAL
SQL> STARTUP;
error al ejecutar la sentencia
SQL> alter database character set WE8MSWIN1252
2 ;
alter database character set WE8MSWIN1252
*
ERROR en linea 1:
ORA-12712: el juego de caracteres nuevo debe ser un superjuego del juego de
caracteres antiguo
Entonces segui la recomendacion de este link estando la base en modo restringido para processos y sesiones tal como se indico arriba
SQL> shutdown immediate;
Base de datos cerrada.
Base de datos desmontada.
Instancia ORACLE cerrada.
SQL> startup;
Instancia ORACLE iniciada.
Total System Global Area 2.0310E+10 bytes
Fixed Size 2212976 bytes
Variable Size 1.1006E+10 bytes
Database Buffers 9126805504 bytes
Redo Buffers 175132672 bytes
Base de datos montada.
Base de datos abierta.
SQL> alter database character set WE8MSWIN1252
2 ;
alter database character set WE8MSWIN1252
*
ERROR en linea 1:
ORA-12712: el juego de caracteres nuevo debe ser un superjuego del juego de
caracteres antiguo
SQL> exit
Desconectado de Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@siilprueba dbs]$ exit
logout
Connection to 172.30.10.65 closed.
heli@centauro:~$ ssh oracle@172.30.10.65
oracle@172.30.10.65's password:
Last login: Fri Sep 16 12:15:26 2011 from 193.0.0.160
[oracle@siilprueba ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Fri Sep 16 14:32:13 2011
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Conectado a:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select value from nls_database_parameters where parameter = 'NLS_CHARACTERSET';
VALUE
--------------------------------------------------------------------------------
AL32UTF8
}
SOLUCION SQL> shutdown immediate;
Base de datos cerrada.
Base de datos desmontada.
Instancia ORACLE cerrada.
SQL> startup mount;
Instancia ORACLE iniciada.
Total System Global Area 2.0310E+10 bytes
Fixed Size 2212976 bytes
Variable Size 1.1006E+10 bytes
Database Buffers 9126805504 bytes
Redo Buffers 175132672 bytes
Base de datos montada.
SQL> ALTER SYSTEM ENABLE RESTRIcted session;
Sistema modificado.
SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
Sistema modificado.
SQL> alter database open;
Base de datos modificada.
SQL> ALTER DATABASE NATIONAL CHARACTER SET WE8MSWIN1252;
ALTER DATABASE NATIONAL CHARACTER SET WE8MSWIN1252
*
ERROR en linea 1:
ORA-12714: juego de caracteres nacional especificado no valido
SQL> ALTER DATABASE CHARACTER SET WE8MSWIN1252;
ALTER DATABASE CHARACTER SET WE8MSWIN1252
*
ERROR en linea 1:
ORA-12712: el juego de caracteres nuevo debe ser un superjuego del juego de
caracteres antiguo
SQL> UPDATE PROPS$ SET VALUE$ = 'WE8MSWIN1252' WHERE NAME = 'NLS_CHARACTERSET';
1 fila actualizada.
SQL> commit;
Confirmacion terminada.
SQL> shutdown immediate;
Base de datos cerrada.
Base de datos desmontada.
Instancia ORACLE cerrada.
SQL> startup;
Instancia ORACLE iniciada.
Total System Global Area 2.0310E+10 bytes
Fixed Size 2212976 bytes
Variable Size 1.1006E+10 bytes
Database Buffers 9126805504 bytes
Redo Buffers 175132672 bytes
Base de datos montada.
Base de datos abierta.
SQL> select value from nls_database_parameters where parameter = 'NLS_CHARACTERSET';
VALUE
----------------------------------------
WE8MSWIN1252
--La base nuevamente y la volvi a subir par aver que hubiera tomado los cambios permanentemente
Lance nuevamente la importacion , ya NO ambiente la variable NLS_LANG
imp usuario/contraseña file=archivo.dmp log=imp_110916_1439_archivo.log ignore=y statistics=none fromuser=deusaurio touser=ausuario
Import terminated successfully with warnings.
jueves, 15 de septiembre de 2011
Instalación cliente oracle 10g en UBUNTU
domingo, 11 de septiembre de 2011
INSTALANDO GROUPWISE EN UBUNTU 11.04
sudo alien -div novell-groupwise-client-8.0.2-92614.i586.rpm
despues
sudo alien -div novell-groupwise-gwcheck-8.0.2-92614.i586.rpm
se instalo sin errores
al ejecutar group wise de la siguiente manera, genera un error
prueba@prueba:/opt/novell/groupwise/client/bin$ sh groupwise.sh
- Download the Groupwise 8 Linux Client Tarball from Novell: http://download.novell.com/index.jsp
- Download Java 6 SE JRE: http://java.sun.com/javase/downloads/index.jsp
- Install prerequisite libraries: sudo apt-get install alien libstdc++5
- Extract archive downloaded from Novell: tar xvfz gw800_client_linux_en.tar.gz
- cd groupwise_8.0.0-84910_lnx_client_en
- sudo alien -i novell-groupwise-gwclient-8.0.0-84910.i586.rpm
- Extract Java 6 SE JRE: ./jre-6u14-linux-i586.bin
- sudo mv jre1.6.0_14 /opt/novell/groupwise/client/jre
Install Groupwise 8.0.1 client on Kubuntu 9.10 64 bit
While Novell supports Linux, it mostly supports SuSE, which uses rpm and not deb packages. But it's still fairly easy to install the Groupwise client on an Ubuntu based system.
First, you'll need some software to do this.
$ sudo apt-get install ia32-libs ia32-sun-java6-bin alien
Then download the client. After you download it, use alien to extract the contents
$ alien -t --veryverbose novell-groupwise-client-8.0.1-88138.i586.rpm
This is scary, but it's really ok. Move to the root and extract the result of the command above. You can test it first to see what it will do. It will add files to /opt and /usr.
$ cd /
$ sudo tar -xzvf /path/to/extract/gw8.0.1-88138_client_linux_en/novell-groupwise-client-8.0.1.tgz
You'll need to replace the included java install with the one installed by the prerequisites above.
$ cd /opt/novell/groupwise/client
$ mv java java.org
$ sudo ln-s /usr/lib/jvm/ia32-java-6-sun/jre ./java
You should be able to run the Groupwise client using the included script.
$ /opt/novell/groupwise/client/bin/groupwise
To add the menu item, copy the desktop file to your local applications folder.
$ cp /opt/novell/groupwise/client/gwclient.desktop ~/.local/share/applications/