DB2 Database Transfer - db2

I am trying to move the db2 database from one server to another.
I have done moving all the tables by using export, import and db2move process.
But I am struck at moving views.
There are many view type tables in old database.
Could anyone please tell me the procedure for moving the view type tables from old Database to new Database?
Thanks in advance.

For db2 object you need to use db2look
Do not create the referential integrity before the load.

Related

how to take backup of specific data from a table and dump it in existing database and table?

I am working on a PostgreSQL database and I need to take a backup of specific data from a table and restore it into the same or a different database. I am looking for a way to accomplish this task using command-line tools or scripts.
I have tried using the pg_dump and pg_restore command-line utilities, but they seem to only allow for backing up and restoring an entire database or table, rather than specific data within a table.
Is there a way to take a backup of specific data from a table in PostgreSQL and restore it into a database? If so, could you provide an example of the command or script that would accomplish this task?
Thanks in advance for your help!

How to replicate rows into different tables of different database in postgresql?

I use postgresql. I have many databases in a server. There is one database which I use the most say 'main'. This 'main' has many tables inside it. And also other databases have many tables inside them.
What I want to do is, whenever a new row is inserted into 'main.users' table I wish to insert the same data into 'users' table of other databases. How shall I do it in postgresql? Similarly I wish to do the same for all actions like UPDATE, DELETE etc.,
I had gone through the "logical replication" concept as suggested by you. In my case I know the source db name up front and I will come to know the target db name as part of the query. So it is going to be dynamic.
How to achieve this? is there any db concept available in postgresql? Or I welcome all other possible ways as well. Please share me some idea on this.
If this is all on the same Postgres instance (aka "cluster"), then I would recommend to use a foreign table to access the tables from the "main" database in the other databases.
Those foreign tables look like "local" tables inside each database, but access the original data in the source database directly, so there is no need to synchronize anything.
Upgrade to a recent PostgreSQL release and use logical replication.
Add a trigger on the table in the master database that uses dblink to access and write the other databases.
Be sure to consider what should be done if the row alreasdy exists remotely, or if the rome server is unreachable.
Also not that updates propogated usign dblink are not rolled back if the inboking transaction is rolled back

Importing data from MS Access db to PostgreSQL db

I have a table in an MS Access db that I want to export to a PostgreSQL database. Every 2 or so months, I want to move all records from the Access table to a table in Postgres.
Right now, I am using the Export to ODBC option in Access to do this, but every time it exports as an entirely new table in Postgres. Is there a way for me to routinely append the records in the Access table to an existing table in my Postgres database? I have come across the option of a FDW but I am not familiar with how to install/use it.
I am new to using PostgreSQL, and have little to no experience working with databases other than Access, so any input/advice would be greatly appreciated.

How can I make existing views in database into files in PostgreSQL?

I have made a database in PostgreSQL 9.3 and made some views in the database.
I was wondering if there is any way to get those views out of database as separate .sql files?
If you want the SQL statement behind the view, you can get that using pg_get_viewdef()
select pg_get_viewdef('your_view_name');
More details in the manual:
http://www.postgresql.org/docs/current/static/functions-info.html#FUNCTIONS-INFO-CATALOG-TABLE
Managed to deal with this by exporting whole database using pg_dump and then making new separate .sql files

How to add new table to the database using sql workbench

I was creating MySQL database to add medicine.I created a table and I need to add one more tabe.After creating it I tried to query the database from the sql workbench.But it donot show the table but it is present in the EER Model.How can I solve this problem.
Modeling is just the task of abstractly designing your schema and its objects (e.g. tables, views etc.). It does not actually create these objects. For this you have to forward engineer your model to a server (see Database menu). Once done you can use the Synchronization feature to update either model or server (or both) with any changes made.
But keep in mind this is only for the objects, not for any data.