create database:
[sourcecode language="bash"]
#create database from bash shell
su - postgres
bash-3.2$ createdb db_name;
bash-3.2$ dropdb db_name;
[/sourcecode]
Or you can go into database:
[sourcecode language="bash"]
#frm psql
#Connect as postgres to the postgres database
psql -d postgres postgres;
postgres=# create database new_db_name;
postgres=# drop database new_db_name;
[/sourcecode]
To backup a Postgresql Database:
[sourcecode language="bash"]
#bash shell
pg_dump -U db_user_name database_name -f backup_file_name.sql
[/sourcecode]
This command is to backup the database_name to file backup_file_name.sql.
To backup a specific schema of the database, use -n parameter
[sourcecode language="bash"]
#bash shell
pg_dump -U htang tripal_dev -n chado -f ~/DBBackups/tripal_dev__chado_only_20110901.sql
[/sourcecode]
To restore a backup from file use the follwing command:
[sourcecode language="bash"]
#bash shell
psql -f backup_file_path_and_name DATABASE_name;
#or you can
psql -d database_name < backup_file_path_and_name;
[/sourcecode]
Subscribe to:
Post Comments (Atom)
Datatable static image not found on the server
When you use ```datatables.min.css``` and ```datatables.min.js``` locally, instead of datatables CDN, you may have encountered that ```sort...
-
Step 1. Install Oracle XE 11g 1. Download Oracle XE (oracle-xe-11.2.0-1.0.x86_64.rpm.zip) from Oracle official website. You need an accoun...
-
When you use ```datatables.min.css``` and ```datatables.min.js``` locally, instead of datatables CDN, you may have encountered that ```sort...
-
I used the following method to hide the extra long column contents when loading the page. The contents will then display when mouse hover th...
No comments:
Post a Comment