martes, 22 de octubre de 2013

Restaurando con IMPDP

-- SÓLO AGREGA LOS DATOS , ELIMINANDO PREVIAMENTE

impdp SYSTEM/***@***  DUMPFILE=ORA***30.dmp TABLES=ESQUEMA.TABLA1 LOGFILE = log_respaldo01.log   table_exists_action=truncate content=DATA_ONLY

-- AGREGA LOS DATOS, PERO DEBE DE CONTAR CON DATOS ACORDE A LA LLAVE PRIMARIA Y/O FORANEA 

impdp SYSTEM/***@***  DUMPFILE=ORA***30.dmp TABLES=ESQUEMA.TABLA1 LOGFILE = log_respaldo01.log table_exists_action=append

-- NORMA QUE LA TABLA NO EXISTA

impdp SYSTEM/***@***  DUMPFILE=ORA***30.dmp tables=ESQUEMA.TABLA1  TABLE_EXISTS_ACTION=replace logfile=impdp_LOG1.log

jueves, 12 de septiembre de 2013

CREATE DATABASE LINK


--------------------------------------------------

en el SERVIDOR1  , creamos el LINK para conectarse al SERVIDOR2

------------------------------------------------------


CREATE DATABASE LINK LKPRUEBA
  CONNECT TO LKPRUEBAIDENTIFIED BY PASS_ASIG USING '(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = 1.1.1.18)
 (PORT = 1521 )) )
(CONNECT_DATA = (SID = bdora) ) )'
/

COMMIT;


------------------------------------------------------------------------------------------------
me conecto al SERVIDOR2
DAMOS PERMISOS A LAS TABLAS QUE SE REQUIEREN CONECTAR CON EL LINK

----------------------



CREATE USER LKPRUEBAIDENTIFIED BY PASS_ASIG
  DEFAULT TABLESPACE USERS
  TEMPORARY TABLESPACE TEMP
  PROFILE DEFAULT;


GRANT CREATE DATABASE LINK TO LKPRUEBA;
GRANT CREATE PUBLIC DATABASE LINK TO LKPRUEBA;
GRANT CONNECT TO LKPRUEBA;
ALTER USER LKPRUEBADEFAULT ROLE CONNECT;

----------------------------


GRANT SELECT ON esquema.tabla1 TO LKPRUEBA;

GRANT SELECT ON esquema.tabla2 TO LKPRUEBA;


-------------------------------
EN EL SERVIDOR1 realizó consultas

select * from esquema.tabla1@LKPRUEBA;

select * from esquema.tabla2@LKPRUEBA;


domingo, 25 de agosto de 2013

Respaldo Mysql con parametros en directiva



# mysqldump --user=root --password=valor+ bd_name > /root/down/xxxx_xxx_2013Ago26_xxxx.sql

martes, 30 de julio de 2013

SPFILE

SQL> CREATE pfile='/tmp/initRAC.ora' FROM spfile;

lunes, 22 de julio de 2013

Crear tabla en MySQL para que acepte las minúsculas y mayúsculas en la llave primaria o bien en los campos que se definan.

Ejemplo de cómo generar la tabla en MySQL para que acepte las minúsculas y mayúsculas en la llave primaria o bien en los campos que se definan:

/*
CREATE TABLE  ingreso.tmp2  (
  matricula VARCHAR(60) COLLATE utf8_bin NOT NULL default '',
  serial  VARCHAR(16) COLLATE utf8_bin NULL default'',
  PRIMARY KEY  (matricula)
) ENGINE=INNODB  DEFAULT CHARSET=utf8 COLLATE=utf8_bin ;
*/

Mysql, index, texto download, ejecución



Mysql, index, texto download, ejecución, muestra primeros registros de una tabla


1.- Emite datos de una tabla en texto para portabilidad:

 SELECT * FROM esquema.tabla1
     INTO OUTFILE "/var/lib/mysql/ingreso/tmp/tabla_1336_210.txt"
     FIELDS TERMINATED BY '||' ;


2.- Carga datos:

\. /var/lib/mysql/ingreso/tmp/tablatexto_TMP_A1.sql


3.- Muestra los indices de una tabla, por esquema en dos formas en su sintaxis:

mysql> SHOW INDEX FROM mytable FROM mydb;

mysql> SHOW INDEX FROM mydb.mytable ;


4.- Muestra los primeros 15 registros de una tabla:

mysql> SELECT * FROM esquema.tabla where periodo= 'A'  limit 15;

6.- En oracle se cambia un date a otro formato que lo acepte MySQL.

 To_Char(fecha_creacion, 'YYYY-MM-DD') AS fecha_creacion                       ,
  To_Char(fecha_ult_modificacion, 'YYYY-MM-DD') AS fecha_ult_modificacion               ,

miércoles, 26 de junio de 2013

Oracle Agente de diagnóstico remoto (RDA) de utilidad

Oracle Agente de diagnóstico remoto (RDA) de utilidad



Oracle Remote Diagnostics Agent (RDA) is used primarily by Oracle Support. I've found that this information is very useful and have used to debug issues in my environment. It is a useful utility to me for particular situations.

The utility ships a readme.txt file for both WIndows and Unix that will help get you started. Rather than discuss everything about RDA and analyze the output it provides, I suggest you give it a whirl. Click on this link and you can view the RDA output.

Many of the most difficult Oracle problems to fix usually are due to some environmental issue or change. It was working yesterday, now it's not, what's different. I use the RDA for a comprehensive environment report. But you'll have to wait a bit, it's not exactly speedy. :-)  
You can download it from MetaLink - Doc ID: 314422.1

Steps and Commands:
UNIX / LINUX
WINDOWS
Unzip Files
use Unix/Linux utility
use any Windows utility
Instructions
README_Unix.txt/README_Linux.txt
README_Windows.txt
Verify Installation
rda.sh -cv
rda.cmd -cv
Run Setup
rda.sh -S or rda.pl -S
rda.cmd -S or rda.pl -S
Run RDA
rda.sh -v or rda.pl -v
rda.cmd -v
To view RDA
Open RDA_INDEX.htm from the RDA output directory


Connection to Database:
Open command prompt.
cmd> set ORACLE_SID=mydb
cmd> sqlplus / as sysdba
And you will be connected to the database.



Oracle Remote Diagnostic Agent (RDA) Report Generation:
Note: I am generating RDA Report on Windows for this article.
Unzip Files:
Unzip the downloaded RDA Utility to a directory ( Here E:/rda ).

Read Instructions:
Go to the directory, where we have unzipped the files and we can read the instructions given in the "Readme_O/S.txt" file.

Verify Installation:
Open command prompt and navigate to the RDA directory.
cmd> rda.cmd -cv

Run Setup:
Open command prompt and navigate to the RDA directory.
cmd> rda.cmd -S
 The script continues on for many more pages as part of the configuration. Choose the options according to your Report need.

Run RDA:
Open command prompt and navigate to the RDA directory.
cmd> rda.cmd -v

View RDA Report:
Open "RDA__index.htm" from the RDA output directory to view the report.

Our RDA Report has been generated.