Index: openacs-4/packages/acs-core-docs/www/database-management.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/database-management.html,v diff -u -r1.16 -r1.17 --- openacs-4/packages/acs-core-docs/www/database-management.html 11 Dec 2003 23:08:45 -0000 1.16 +++ openacs-4/packages/acs-core-docs/www/database-management.html 4 Feb 2004 16:47:32 -0000 1.17 @@ -1,4 +1,4 @@ -Database Management

Database Management

By Joel Aufrecht

+Database Management

Database Management

By Joel Aufrecht

OpenACS docs are written by the named authors, and may be edited by OpenACS documentation staff.

Running a PostgreSQL database on another server

To run a database on a different machine than the @@ -10,25 +10,21 @@ permit specific remote clients to access. Access can be controlled ... (add notes from forum post)

  • Change the OpenACS service's configuration file to point to the remote database. Edit - /web/service0/etc/config.tcl + /var/lib/aolserver/service0/etc/config.tcl and change

    to

  • Deleting a tablespace

    Skip down for instructions on Deleting a PostgreSQL tablespace.

    Deleting an Oracle tablespace

    Should it become necessary to rebuild a tablespace from scratch, you can use the drop user command in SVRMGRL with the cascade option. This command will drop the user and every database object - the user owns.

    -SVRMGR> drop user service0 cascade;

    + the user owns.

    SVRMGR> drop user service0 cascade;

    If this does not work because svrmgrl "cannot drop a user that is currently connected", make sure to kill the AOLserver using - this user. If it still does not work, do:

    -SVRMGR> select username, sid, serial# from v$session where lower(username)='service0';

    and then

    -SVRMGR> alter system kill session 'sid,serial#';

    + this user. If it still does not work, do:

    SVRMGR> select username, sid, serial# from v$session where lower(username)='service0';

    and then

    SVRMGR> alter system kill session 'sid, serial#';

    where sid and serial# are replaced with the corresponding values for the open session.

    Use with caution!

    If you feel the need to delete everything - related to the service, you can also issue the following:

    -SVRMGR> drop tablespace service0 including contents cascade constraints;

    Deleting a PostgreSQL tablespace

    + related to the service, you can also issue the following:

    SVRMGR> drop tablespace service0 including contents cascade constraints;

    Deleting a PostgreSQL tablespace

    Dropping a PostgreSQL tablespace is easy. You have to stop any AOLserver instances that are using the database that you wish to drop. If you're using daemontools, this is simple, just use the @@ -37,7 +33,7 @@ reread the inittab with /sbin/init q, and then restart-aolserver service0.

    Then, to drop the db, just do:

    -service0:~$ dropdb service0
    +[service0 ~]$ dropdb service0
     DROP DATABASE

    Vacuum Postgres nightly

    The "vacuum" command must be run periodically to reclaim space. The "vacuum analyze" form additionally collects statistics on the @@ -51,7 +47,6 @@ backup! The "vacuum" command is very reliable, but conservatism is the key to good system management. So, if you're using the export procedure described above, you don't need to do this extra step. -

    Edit your crontab:

    -joeuser:~$ crontab -e

    We'll set vacuum up to run nightly at 1 AM. Add the following +

    Edit your crontab:

    [joeuser ~]$ crontab -e

    We'll set vacuum up to run nightly at 1 AM. Add the following line:

    -0 1 * * * /usr/local/pgsql/bin/vacuumdb birdnotes
    ($Id$)
    View comments on this page at openacs.org
    +0 1 * * * /usr/local/pgsql/bin/vacuumdb service0
    ($Id$)
    View comments on this page at openacs.org