I need restore a DB2 database of Websphere portal to another server, but I don't have a backup file, I have only a folder NODE0000 (image here => https://i.stack.imgur.com/A7UpL.jpg).
How can I restore this database to another server with this folder?
My environment: CentOS 7 - IBM DB2 9.1 (installed fix pack 4)
Thank a lot!
Your requirement is similar to cloning database using a split mirror. You can try following steps
Create instance db2inst1 on new machine if it is not created during db2 installation
Copy NODE0000 directory to location /home/db2inst1/db2inst1
Set owner to db2inst1 for directory NODE0000 and all sub-directories and files under NODE0000
Catalog database you want to access. Example: db2 catalog db commdb on /home/db2inst1
Connect to database
Related
I am an Oracle DBA and I got a bkp.tar.tgz PostgreSQL backup file to restore on server. Vendor provided backup file before closing contract. I don't have any information for backup file.
I have below questions.
PostgreSQL backup can be restored on cross platform OS? If no, then how can I know what is source OS.
PostgreSQL db version needs to be same? Or doesn't matter? How to find db version from bkp file? They said it's PostgreSQL 9.4.5
Is there any other way I can access data from backup file?
I'm trying to update my OpenProject from v7.0 to v8.0 using the new Docker image.Everything went well till I try to import the database. The new version uses Postgresql v9.6 which is incompatible with the former Postgresql v9.4.
There is a good guide on the OpenProject website on how to migrate to Postgresql v9.6: https://www.openproject.org/operations/upgrading/openproject-postgresql-migration-guide-9-6/ . But it covers only the linux installation.
How is it possible to migrate the OpenProject database from Postgresql v9.4 to v9.6 within docker ?
Finally a solution is found. Here are the general steps for the migration:
Create the database backup of the current installation:
Connect to the old Container v7.0
Stop the running services, except postgers, via supervisorctl stop < service_name >
Create the dump of the database with the name "openproject"
Exit the container and copy the created dump outside it
Restore the database into a the new installation:
Copy the former created dump inside the new container v8.0
Connect to the new Container v8.0
Stop the running services, except postgers, via supervisorctl stop < service_name >
Connect to the postgresql database server and delete the database "openproject"
Create a new "openproject" database and assign it to the user "openproject"
Restore the openproject database using the dump file
Exit and restart the container
OpenProject system will automatically recognize the old database structure and will migrate the tables to match the new version.
I hope this will help someone
Till now I've been backing up my postgresql data using pg_dump, which exports the data to an sql file mydb.sql, and then restoring from that sql file using psql -U user -d db < mydb.sql.
For one reason or another it would be more convenient to restore the database content more directly, in an environment where psql does not exist... specifically on a host server where postgresql is installed in a docker container running on the host, but not on the host itself.
My plan is to back up the content of /var/lib/postgresql/data/ to a tar file, and when required (e.g. when a new server is created that hosts the postgresql container) just restore that to the same path. The folder /var/lib/postgresql/data/ in the docker container is mapped to a folder on the host server, so I would create this backup on the host, not inside the postgres container.
Is this a valid approach? Any "gotchas"? And are there any subfolders within /var/lib/postgresql/data/ that I can exclude from the tar file? I don't want to back up mere 'housekeeping' information.
You can do that, but you have to do it properly if you don't want your database to become corrupted.
Either stop PostgreSQL before copying the data directory or follow the instructions from the documentation for an online backup.
I have a db2 database on a device which does not have internect connectivity and would like to move this database to another place. I have taken a backup from my database, can I use the 'restore' command to create a clone of this database?
To move a Db2 database from on-premise to Db2 Warehouse on Cloud, one option is to use IBM Lift CLI. https://www.lift-cli.cloud.ibm.com/
You will need to have internet connectivity from the place your data resides on-premise - either a Db2 database, or failing that CSV files.
If all you have is a Db2 backup image, you would need to restore that into a local database, or use the (chargeable) utility High Performance Unload to extract table data as CSV files from the backup image. IBM Lift CLI does not support Db2 backup images as a source for migration to the cloud.
Note that if you use CSV files, you will need to extract the DDL from the source database and create the empty tables on the target.
When I am restoring the database, by default data is going in C drive, but when I installed the db2 that time I specify the path in D drive only.
Also, sample database files created by db2 is stored in D drive.
Can anyone please tell me what is the issue?
I have run this command:
SELECT * FROM SYSIBMADM.DBPATHS
below is the result i fetched:
LOGPATH- D:\DB2\NODE000\SQL00001\SQLOGDIR\
DB_STORAGE_PATH- C:\
LOCAL_DB_DIRECTORY - D:\DB2\NODE000\SQLOGDIR\
DBPATH - D:\DB2\NODE000\SQL00001\
I Want to change this DB_STORAGE_PATH C:\ to D:\ for all the database which i will be restoring.
You can run db2set from db2 command line that will confirm you wheather db2 installed on path with other information;
db2-command-line> db2set
DB2_ATS_ENABLE=YES
DB2_CREATE_DB_ON_PATH=YES
DB2INSTPROF=C:\where\db2\installed\IBM\DB2\DB2COPY1
DB2COMM=TCPIP
You can get more information of Directory structure for your installed DB2 database product (Windows) here
You can run the following command SELECT * FROM SYSIBMADM.DBPATHS. This will give details of following variables of your installed db2 database;
LOGPATH
DB_STORAGE_PATH
LOCAL_DB_DIRECTORY
DBPATH
These commands will provide you enough information to locate your installed database. Then you can restore your database providing the exact path.
To add a storage path to an existing database, issue the following ALTER DATABASE statement:
ALTER DATABASE database-name ADD STORAGE ON storage-path
After adding one or more storage paths to the database, you may use the ALTER TABLESPACE statement to rebalance table spaces in the database so that they start to use the new storage paths immediately.
DB2 has a configuration parameter for the default path for databases, dftdbpath. In addition, the command db2sampl to create a sample database has an option dbpath to specify where to place that database.
db2sample -dbpath D:
The above would place the new database on drive D:.
You will find that there are default paths for certain operations. The overview of DB2 database manager configuration parameters has lists most of them.
For your specific issue I would assume that a parameter was changed some time after DB2 was installed and used initially.
For RESTORE be aware that the options TO and DBPATH are ignored if restoring an existing database.