Replica Oracle

Necesito hacer una copia de una DB Oracle "A" a otra DB Oracle "B", ambas estan en Servidores Sun pero maquinas distintas (Distinta IP), esta copia es solo de una tablas no de toda la base, sabes de que forma lo puedo hacer, ¿no se si se pueda con el comando EXP?.

2 Respuestas

Respuesta
1
Si tienes alguna forma (por ejemplo una fecha) de saber cuales son los registros que se han adicionado, se podría utilizar la clausula query del export para solo insertar estos registros. Si es imposible tener este mecanismo existe dos soluciones 1) borrar la tabla y volverla a importar. 2) Backup incremental usando el RMAN.
Alberto Rico Avendaño
OK. El siguiente es un artículo de como realizar este export con query. Espero que le sirva. Si desea le puedo enviar un artículo sobre incremental backup con RMAN.
Oracle 8i introduced the use of the 'where' clause as an export parameter which gets appended to the select statement that export uses to retrieve the table data. - Cannot be used with Direct Path Export. - Use the QUERY parameter of the export utility to pass the WHERE clause. As we will see in the following examples, using the QUERY parameter can get messy because of how the different OS treat quotes in the command line.
UNIX syntax: ---------------- - Example: Export table data from DEMO.EMP that only includes FRAN like last names. exp demo/demo query=\"where lname like \'FRAN%\'\" tables=emp file=exp.dmp log=exp.log - Example: If you want to export multiple tables and use the QUERY parameter in the export, the WHERE clause must be applicable to all tables. Export all data for employees and customers residing in the state of New York. exp demo/demo query=\"where st=\'NY\'\" tables=(emp,cust) file=exp.dmp log=exp.log In the Utilities Guide we are warned of the possibility of needing to use the UNIX escape ('\') to make some UNIX reserved characters a literal rather than being interpreted as the reserved character. The example given is query=\"where JOB = \'SALESMAN\' and salary \< 1600\" Note that the ", ', and < are all UNIX reserved characters and thus need to be escaped. However, an important addendum to this is that this only applies when giving export options at the command line. If you are using a parfile these need not be escaped, and in fact it will cause an error if you do. The same option in a parfile would look like query="where JOB = 'SALESMAN' and salary < 1600" Note the need for the double quotes as this is still a UNIX argument and spaces are not allowed. The double quotes are necessary to tell UNIX this is a string literal. If there are no single quotes in the query string you may use single quotes or double quotes to denote the literal. Some examples of valid arguments, given a table FOO(BAR number) From the command line: query=\'where bar = 2\' query=\"where bar = 2\" (note that here we may use single or double quotes) query=\'where bar \< 2\' (note the extra \ to allow the use of the < as a literal) These three in a parfile would simply be(respectively): query='where bar=2' query="where bar=2" query='where bar < 2' WINDOWS NT / 2000 and NETWARE syntax: --------------------------------------------------------- Under WindowsNT or Windows 2000, as well as NetWare, the following syntax applies: Example: EXP demo/demo tables=test file=exp1.dmp query="""where enum >12345""" NOTE: There should be NO spaces surrounding the double quotes in the following statement. There are NO spaces between the double quotes either. If you are going to use a 'PARFILE' parameter instead, then use the following syntax in the Parfile: file=exp66.dmp query="where enum > 12345" tables=(test) log=log66.txt userid=demo/demo Explanation ----------- Since the QUERY parameter contains blanks, Windows NT or Win2000 requires that the entire 'WHERE' clause be placed in 3 double quotes (""")to escape the blanks and reserved characters that the operating system normally looks for. If using the 'PARFILE' parameter, you will only need a single set of double quotes(").
Hola, esta Replica que te comento la quiero hacer cada sabado por la noche dejandola de forma automatica, la base en el servidor B ya esta creada pero como ves, me conviene borrarla y crearla cada vez o solo copiar los datos de las tablas?
Si tengo manera de saber cuales registros son nuevos precisamente por fecha pero quisiera pasar toda la tabla por que en ocasiones los registros sufren cambios, tienes algun ejemplo del export con el query para poderlo adaptar a mi DB?, gracias.
Si ya se ha creado una base de datos en el servidor B se puede usar el export de los archivos que necesite con el parametro tables y colocando las tablas que necesites, teniendo en cuenta el usuario sobre el cual se va a realizar el import(verificando los permisos). Si no se ha creado la base de datos en el servidor B le puedo hacer llegar un script que utilizo mucho para linux y se podría acomodar para sun y que crea la base de datos.
Salu2
Alberto Rico Avendaño
Respuesta

I like your post is very expensive great information . thanks for it share with us .

Dwarka Escorts

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas