Hi Jim,
You wrote:
I am getting this error when I try to run the command 'db2 "backup
database dbname online to /opt/BACKUP"' on my 3 databases:
SQL1042C An unexpected system error occurred. SQLSTATE=58004
SQL1084C Shared memory segments cannot be allocated. SQLSTATE=57019
SQL1084C Shared memory segments cannot be allocated. SQLSTATE=57019
I have done some research and my shmmax is set to '1073741824'.
This is the maximum size of a segment.
Your problem might be the maximum number of segments is too low.
extract of "man shmget":
The followings are limits on shared memory segment resources affecting a
shmget call:
SHMALL System wide maximum of shared memory pages: policy dependent.
SHMMAX Maximum size in bytes for a shared memory segment:
implementation dependent (currently 4M).
SHMMIN Minimum size in bytes for a shared memory segment:
implementation dependent (currently 1 byte, though PAGE_SIZE is
the effective minimum size).
SHMMNI System wide maximum number of shared memory segments:
implementation dependent (currently 4096, was 128 before Linux
2.3.99).
1) How can I get this to back up? :)
Increase SHMMNI/SHMALL parameters and retry.
2) What are my options to move the database to a new server with these
problems?
Maybe shared memory segments got lost somehow: stop instance, use ipclean or
ipcs/ipcrm to free segs, start instance, if this does not help, reboot.
Maybe an offline backup works?
If this all won't work (and noone else has a better idea), you can copy the
database file by file (with cp, tar, ...).
You have to consider some things then:
- This won't work online. Best/easiest to stop the instance before copying.
- Get the source path with "db2 list db directory" and
"db2 get db directory on /path/for/db/from/cmd/above")
- Don't forget to copy tablespace containers you created outside of the
database directory (check with "db2 list tablespaces" and
"db2 list tablespace containers for <TBSPACE_ID_from_cmd_above>").
- Preserve user, group and permissions (e.g. use tar).
- Recreate exactly the same directory structure (using links is ok if you
have another physical disk layout on the new server)
- Create an instance with the same name, users and groups (with same ID's)
- Target system should be same/newer db2 version and same/newer fixpak level
(if newer you might have to migrate the database)
- Catalog the database on the new server
(db2 catalog database xy on /path/from/list/db/cmd/above)
HTH
Joachim Banzhaf