I'm new with Odoo and I want to see just the database tables (the data is not really important) from database IDE e.g. DataGrip. There are 2 options to download the database from Odoo:
zip (includes filestore)
pg_dump custom format (without filestore)
I create a temporary Postgres database to import the file. It seem like the dump.sql from zip (includes filestore) work when I imported, but I get some errors like:
The JDBC driver currently does not support COPY operations.
multiple primary keys for table "stock_rules_report" are not allowed
etc
Log summary:
Summary: 11748 of 11748 statements executed, 4886 failed in 16 s 642 ms (1525350 symbols in file)
Environment:
Odoo 12
Postgres 10 & 13
DataGrip
Take the custom format dump and restore it with the PostgreSQL client tool pg_restore:
pg_restore --schema-only -d targetdb -h dbhost -p 5432 -U postgres dumpfile
That will restore only the table definitions without the data.
Backup and Restore using url:port/web/database/manager
https://odoosolution.blogspot.com/2021/01/odoo-database-backup-restore.html
Related
I am using Postgres db. I need to migrate this database to Microsoft SQL Server database. Is there any possible way?
Use this command:
pg_dump -U username your_db_name > db_backup.sql --column-inserts
The --column-inserts option generates INSERT statements possible for each row of data and should be compatible, but you may have to change the syntax just a little bit. (And it may cause data-loss, https://www.postgresql.org/docs/current/app-pgdump.html)
Then just simply open the .sql file and run it inside SqlServer
My customers runs an very old (seems to me) Sybase 12.5.2 database. I want/need to export all tables from a database to multiple (for each table) flat (text) files. I have access to ISQL command line prompt with the admin user. I havent worked ever with an Sybase database before.
Sybase Adaptive Server Enterprise (ASE) allows multiple databases to be hosted. You don't specify whether only one of the databases in the database server needs to be exported or if all of them do.
For each database, the following query will list the names of the tables
select name from sysobjects where type = 'U'
Sybase ASE also comes with a tool called "bcp" which stands for "Bulk Copy". It is an easy way of creating a flat file of a table's contents.
bcp database.schema.table out file_name -c -U username -S server_name
It has more options that may be of interest, especially around field and row terminators. Documentation for the most relevant version (12.5.1) can be found here:
http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.dc30191_1251/html/utility/BABGCCIC.htm
i have been using BCP commands to export data from sybase environments.bcp is a command line utility which you can use it to export data from multiple types of databases
below is a very example and you can try it for
bcp Table Name out OUTPUT FILE PATH\FILENAME.dat -S SERVER NAME -U USERNAME -P PASSWORD -F Format -r row_terminator -e error output file path and name
You can create a batch file with such commands and do multiple exports on one hit.
If you have access to any ETL tool you can exporting the data using the same as well.
I am trying to move a schema from one database to another using pg_dump.
I am running this command to take a backup of my schema
pg_dump.exe -h myhost -U postgres -d mydb-n schema> C:\Temp\schema.dump
To restore it I copy the SQL into pgadmin, but I get this error. I don't know what the issue is ?
ERROR: syntax error at or near "2"
LINE 284: 2 \N Unregistered. Item \N 2016-07-13 00:00:00 \N
Is there a best recommended way to backup/restore a postgres database? I often run into issues similar issues when backing up/restoring databases and I start to worry that I will loose valuable data one day.
A plain text pg_dump cannot be restored with pgAdmin since pgAdmin cannot perform COPY FROM STDIN, which is used by pg_dump for the data by default.
You'll have to use psql to restore the dump.
An alternative would be to use the --inserts option of pg_dump so that the data are dumped as INSERT statrments. This comes with a performance penalty though.
I have a question about importing a sql file to postgres CLI. I may have been improperly importing my file or either I may have some User or Database privilege?!? issue. Anyways, these are just my hunches. I am trying to pinpoint the cause of this message after importing a sql file.
The message that I get is:
No relations found.
The steps I did to get into Postgres are:
I typed in:
sudo -i -u postgres
psql
then i created a new role, altered the role permission
and then created a new database as well
i got all my commands from this site http://blog.jasonmeridth.com/posts/postgresql-command-line-cheat-sheet/
last step was I imported a sql file by typing:
psql -d db_name_dev -U username_dev -f /www/dbexport.sql
Now when I go inside the database I created "db_name_dev" by typing
psql db_name_dev and check to see any content imported by typing \dt
I get
No relations found.
here is also a table and role list from my command line..
http://screencast.com/t/8ZMqBLNRb
I'm thinking my database might also have some access privilege issue..
also here is an additional issue i ran into.. hope this helps..
http://screencast.com/t/BJy0ZjrALm6h
thanks,
any feedback would be appreciated
ok so after a few research and readings, i found out my .sql file was empty.. here are some links ive read and learnt more about pg_dump command dbforums.com/showthread.php?1646161-Postgresql-Restores and pg_dump vs pg_dumpall? which one to use to database backups?
I am looking for a command line program that extracts a script containing commands for creations of all database objects (tables, views, procedures, generators, types). It should work with MySQL, Firebird, Oracle and MS SQL Server.
As a part of our automatic build process we would like to put in our SVN repository a script for database creation in an automatic fashion. Firebird comes with a tool that do what we want but we prefer a generic one so we can include as an ANT task.
For SQL Server you can use the Database Publishing Wizard
I can't help you with the other DB's, however. Good Luck.
To Script the Schema and Data
sqlpubwiz script -d YourDB -S YourServer -U YourUsernam -P pwdhere C:\DestFile.sql
and to just script the Schema
sqlpubwiz script -d YourDB -S YourServer -U YourUsernam -P pwdhere C:\DestFile.sql -schema