showing posts tagged with 'database'
by lunarg on June 5th 2011, at 13:17

To have scripted automated backup of PostgreSQL databases on a linux platform, you can create a script like so:

PGPASSWORD="your-password" /usr/bin/pg_dump -U user database > sql-file.sql

Replace user and your-password with your username and password; replace database with the database you want to backup. The output of the dump goes to stdout and can be piped to a plain text file or compressed to something else.

by lunarg on March 8th 2011, at 10:24
It's possible to rename the logical names of MS-SQL databases through the SQL-prompt (osql.exe).

Log in to your database using osql:

> osql -S SERVERINSTANCE -d MyDB -U sa

First, query the current logical names; you will need them in order to rename them.

1> SELECT * FROM sysfiles2> GOfileid groupid size maxsize growth status perf name filename1 1 106224 -1 10 1048578 0 OldName_Data D:\SQL2000\Data\MyDB_Data.mdf2 0 128 -1 10 1048642 0 OldName_Log D:\SQL2000\Data\MyDB_Log.ldf

The name column specifies the logical names. Use the following SQL statement to rename them.

1> ALTER DATABASE [MyDB] MODIFY FILE (NAME = 'OldName_Data', NEWNAME = 'NewName_Data'  ...
by lunarg on March 8th 2011, at 10:09

Something to remember: escaping entities (e.g. when you have table or field names that are the same as reserved words) is possible using square brackets

Some examples:


I had to use this while renaming logical names, which had a dot in their name.

showing posts tagged with 'database'
« April 2021»
« Most people tend to avoid true conflict. Ironically this breeds more conflict. »