![]() ![]() template0 and template1 are skeleton databases that are or can be used by the CREATE DATABASE command. ![]() Most Postgres servers have three databases defined by default: template0, template1 and postgres. UTF - 8 | = c / postgres + | | | | | postgres = CTc / postgres ( 4 rows ) Switching Databases UTF - 8 | = c / postgres + | | | | | postgres = CTc / postgres template1 | postgres | UTF8 | en_US. UTF - 8 | template0 | postgres | UTF8 | en_US. Postgres =# \ l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges -+-+-+-+-+- postgres | postgres | UTF8 | en_US. To view all of the defined databases on the server you can use the \list meta-command or its shortcut \l. Each database is stored as a separate set of files in its own directory within the server’s data directory. Listing DatabasesĪ single Postgres server process can manage multiple databases at the same time. ![]() They are denoted by a backslash and then followed by the command and its arguments. Meta-commands are commands that are evaluated by psql and often translated into SQL that is issued against the system tables on the server, saving administrators time when performing routine tasks. In addition to being able to submit raw SQL queries to the server via psql you can also take advantage of the psql meta-commands to obtain information from the server. In this tutorial, we will learn how to answer these key questions from the command line using psql. This involves asking questions like “Which databases reside on this server?” or “What tables are stored in a particular database on this server?”. One of the most common tasks a database administrator performs is simply getting familiar with the environment. However, Postgres itself comes bundled with a powerful command line tool called psql which is great for those familiar with the terminal or looking to script administration tasks. When it comes to administering Postgres databases, there’s a wide variety of third party tools available such as SQL Workbench/J or pgAdmin III. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |