This affects the categorization of characters, e.g., lower, upper and digit. lc_ctypeĬharacter classification ( LC_CTYPE) to use in the new database. The default is to use the collation order of the template database. This affects the sort order applied to strings, e.g., in queries with ORDER BY, as well as the order used in indexes on text columns. lc_collateĬollation order ( LC_COLLATE) to use in the new database. The character sets supported by the PostgreSQL server are described in Section 23.3.1. Specify a string constant (e.g., 'SQL_ASCII'), or an integer encoding number, or DEFAULT to use the default encoding (namely, the encoding of the template database). encodingĬharacter set encoding to use in the new database. The name of the template from which to create the new database, or DEFAULT to use the default template ( template1). To create a database owned by another role, you must be a direct or indirect member of that role, or be a superuser. The role name of the user who will own the new database, or DEFAULT to use the default (namely, the user executing the command). Now the db.sql file is plain text and you can read it and see if everything is as expected.The name of a database to create. sql file using the pg_restore command like so: You can decompress the data and generate a plain text. One issue, as a result, you just can't read it as a normal human being. The binary format of the output is better because it is more likely to safe all the necessary data than the SQL text format. ![]() Get the version and name and concatenate them with a slash in between. The pg_lsclusters will give you a list of your custers, such as: ![]() Pg_restore -cluster 9.3/main -dbanem=db -host=localhost -username=drupal -password db.pgsql To force a cluster run the following two commands: In case you are running multiple clusters, the pg_restore scheme will select the specific pg_restore of the first running cluster (at least in my experience.) The obvious result is: you are likely to get the wrong one. The name at the end of the command line ( db.pgsql) is the filename that you transferred on your new server. By creating the database manually you can also change its name at that time. Note that -dbname is the name of the database in PostgreSQL. Pg_restore -dbname=db -host=localhost -username=drupal -password db.pgsql ![]() Now, on your new server, run the restore with something like this:įirst create the database (you can also ask the pg_restore command to do that, but I prefer to do it myself to make sure I don't get errors): user$ psql template1 Then copy the file from your current server to the new server, maybe something like that: ![]() So you may be able to simplify the command line to: Also the -host is not required if it is localhost (the default). If you do not have a password in your database, then do not use the -username and -password. Pg_dump -format=c -file=db.pgsql -host=localhost -username=login -password db In any event, in most cases the following commands are enough (I used them with Drupal websites and since they stopped using some of the definitions they have in the system.install file used on initialization, it works as is.) I do not know how to get that to work (and maybe it works in newer version of PostgreSQL?) In most cases that works great, however, some applications may create things such as additional functions that will NOT make it across. When moving a database from one computer to another, you've got to copy all the data.įor that purpose PostgreSQL offers a pair of functions named pg_dump and pg_restore.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |