Copying data from one CockroachDB cluster to another - cockroachdb

I’m looking to copy the data from a production CockroachDB database to a development server. I know that in Postgres, I can directly connect the database servers through pg_dump and psql. What's the quickest, easiest way of doing this in CockroachDB?

The easiest way is probably to just create a dump through cockroach dump, and then import the SQL file it generates onto the new server:
cockroach dump --host=prodhost dbname > backup.sql
cockroach sql --host=devhost -e 'CREATE DATABASE dbname'
cockroach sql --host=devhost --database=dbname < backupsql
If all you really care to copy is the database's schema (e.g. if you’re moving from dev to production), you can do so by adding the --dump-mode=schema option to the cockroach dump command.

Related

What do I have to do to enable the DML replication in the Oracle 18c EE?

I have installed the Oracle DB 18c EE. I have installed the Oracle GoldenGate.
My test replication is good.
Then: I have modified the EXTRACT to DDL replication.
But logs say me: You have to prepare the Oracle DB.
The log message:
2019-08-02 17:29:05 ERROR OGG-00529 DDL Replication is enabled but table dima.GGS_DDL_HIST is not found. Please check DDL installation in the database.
There is No Scripts like in the article for the Oracle DB 12 (marker_table, and etc.) in my deployment (18c). DML replication works.
What Do I have to do in a Oracle 18c EE installation to enable the DDL in the DB?
If You are using the SQLPlus in the $ORACLE_HOME/bin path You will be using a full path to scripts. All scripts are placed in the Golden Gate root directory.
Use a cd:
export PATH=$PATH:$ORACLE_HOME/bin
cd /home/oracle/ggs/
sqlplus / as sysdba
The Full Guide is : DDL Guide

How to restore database with impdp

I have Oracle 12c database and I execute expdp command to create dump file. Later I want to be able to restore database using this dump file, on the same location as where the dump was created from. I don't want to stop database, which is required to drop schema (or execute any 'shutdown immediate', which is required for doing the same with flashbacks).
If I execute impdp with remap_schema=myschema:myschema, I get many errors. When I try it with table_exists_action=replace, I also get errors (ORA numbers: 31684, 39111, 39083, 31085, 39325, 31061, 06512, 29329).
How can I restore database in the same location? Thanks!

Run two MonetDB databases simoultaneously in Windows

I'm trying to run two MonetDB databases simoultaneously in Windows.
I changed the database name in M5server.bat to mydb, and added -database=mydb to mclient.bat
Then I copied the M5server.bat file and changed the farm to mydb2. I also copied the mclient.bat file and added -database=mydb2.
I run the two server bats to start the two databases and that seems to work fine (no errors).
Then I run the first mclient.bat and it connects to the server with no issues.
But when I run the copied mclient.bat and try to connect using user/password monetdb/monetdb, I get the following error and cannot connect:
request for database 'mydb2', but this is database 'mydb', did
you mean to connect to monetdbd instead?
How to run two databases simoultaneously in Windows? How to connect to two databases at the same time?
You should use different ports for different databases:
Example db1:
mserver5.bat file
--set "mapi_port=50001"
mclient.bat file
-p 50001
Example db2:
mserver5.bat file
--set "mapi_port=50002"
mclient.bat file
-p 50002

Error while restoring oracle 10g .dmp file in oracle database 12c

I've got a .dmp file created with Oracle 10g containing the database of one of my clients. I can't for the life of me get it set up with my 12c installation. I can connect to my db using https://localhost:5500/em
I've created a user 'BOB' in my desired PDB and granted import, read and write permissions. Next I try to import using the following command:
impdp BOB/password#//localhost:1521/pdbname full=y directory=dpdump_dir dumpfile=BOB.dmp
However this gives me the following errors:
UDI-12541: operation generated ORACLE error 12541
ORA-12541: TNS:listener does not currently know of service requested in connect descriptor
In the listener.ora and tnsnames.ora i have EZCONNECTOR and ports 1521. Does anyone know how to get this to work?
Many thanks in advance,
Bob
First ensure that you can do tnsping for pdbname to ensure db connect :- $ tnsping bdbname
If you get details of connection string by tnsping, you can try command with following format:
impdp bob/password#127.0.0.1:1521/pdbname directory=dpdump_dir dumpfile=BOB.dmp
I have removed "full=y" as it's not required if you are not restoring full database, specially it used apply with imp/exp utility.
You should remember that pdbname is being specified as a dbname/service_name in your example. You can confirm service_name by following command:
$ lsnrctl services; /* You can get service name and put it on your impdp command. */
In addition, you can try without specifying ip,port and dbname as you are working in localhost itself:
$ impdp bob/password directory=dpdump_dir dumpfile=BOB.dmp
First of all, you should check the connection
sqlplus> BOB/password#localhost:1521/pdbname
If you cannot connect, please connect with sys / as sysdba
Then using command:
SQL> alter session set container=pdbname
SQL> alter pluggable database pdbname open
Then quit and try to your command again. :)

Oracle moving / transferring schemas from one server to another

I am having to move databases from one server to another.
Oracle on Server A has died so I can't back up the existing databases in order to move them across.
I was wondering if there is another way to move databases across servers in Oracle.
There is a way of coping some data and control files and installing them in a new server.
See: User-Managed Backup and Recovery Guide
http://download.oracle.com/docs/cd/B10501_01/server.920/a96572/toc.htm
( but look for the correct version of your database)
For example something like:
% cp /disk1/oracle/dbs/*.dbf /disk2/backup
% cp /disk1/oracle/dbs/*.cf /disk2/backup
% cp /disk1/oracle/network/admin/*.ora /disk2/backup
% cp /disk1/oracle/rdbms/admin/*.ora /disk2/backup
If the old database shut down relatively cleanly you should be able to just copy the db files over to the new host. "db files" includes datafiles, tempfiles, control files, and online redo logs (off the top of my head). If you can make the directory structures on the new host the same as the old ones, you should then just be able to source the correct environment (including ORACLE_SID) and then issue a startup from SQL*Plus. You use the phrase "Oracle service" in your answer to my question, so I'm guessing you are on Windows - I don't know how you go about re-registering it as a Windows service.
If the servers are the same os then yes. You can create the same directory structure on the new server as the old. Install the oracle software and patch it to the same version as on the old window server. Copy all the datafiles, control files, spfile , etc to their respective location on the new server. Using the account you install oracle which has administrator privelege and belonging to the dba group, run oradim to add the service to windows to start oracle, point it to the spfile of your database.
ORADIMxx -NEW -SID -INTPWD -STARTMODE
-PFILE
or with newer database version:
ORADIM -NEW -SID | -ASMSID [-SYSPWD password]
[-STARTMODE auto | manual] [-SRVCSTART system | demand]
[-PFILE filename | -SPFILE]

Resources