Ir al contenido
Menú
Se marcó esta pregunta
4 Respuestas
198 Vistas

Hello Everyone,


While downloading the Database its create sql file . so my question is how to use sql to create new database with same data


Thank you very much for support

Avatar
Descartar

"Database" is not a question. A question is a substantial phrase that ends with "?"

We get close to 1,000 posts a month and not everyone will open a post to find out what your question is.

I have edited your post to make the title a question.

In the future, please consider (1) using a Question that makes it clear what you ask without requiring people to open your post and (2) adding Tags. This will often increase the chances people will respond and also make everything clearer for others who may come along later searching for the same thing.

Failing that, you can paste your future posts into an AI Chatbot and ask it to "please generate a question of no more than 16 words that summarizes what I am asking" and use that as your question.

See also https://www.odoo.com/forum/help-1/meta-why-do-some-questions-get-answers-and-others-do-not-25620

Mejor respuesta

In terminal execute below commands one by one

sudo -u postgres psql -c 'create database your_db_name';

sudo -u postgres psql -c 'grant all privileges on database your_db_name to username';

psql -U username your_db_name < your sql path which refers to .sql file

After restore, open terminal and try to access your db with psql your_db_name

Alter db user if required

Avatar
Descartar
Autor Mejor respuesta

Hello Sir,

instead of   PostgreSQL . shall i use sql plus?

Avatar
Descartar
Mejor respuesta

Yes, you can create new database without file storage ( exclude files, image etc). Only data can see create new database.

Avatar
Descartar
Mejor respuesta

Hi,


When you download an Odoo database as a .sql file, it contains a complete dump of your PostgreSQL database.


Make sure you have PostgreSQL installed on your server or local machine.


Create a new empty database in PostgreSQL using createdb new_db_name; or via pgAdmin.


Ensure the PostgreSQL user you are using has proper permissions for the new database.


Use the psql command-line tool to restore the SQL dump:

psql -U username -d new_db_name -f path_to_sql_file.sql

Wait until the process finishes; it will recreate all tables, data, and sequences from the original database.


After import, configure your Odoo odoo.conf file to point to this new database (db_name = new_db_name).


Restart your Odoo server and log in using the same credentials from the original database; all data should now be available in the new database.


For detailed db restore and backup process refer this blog : https://www.cybrosys.com/blog/how-to-restore-a-database-in-odoo-18-erp


Hope it helps.

Avatar
Descartar