er on ids9.20
Posted in 2000
Topics: Server Administration
hi is there any way of defining a replicate for all tables in a database without actually typing each table name? I tried cdr define replicate --conflict=ignore repl1 "P dba@g_dbserva:informix.*" "select * from *" \\ "R dba@g_dbservb:informix.*" "select * from *" but it didn't work! please help as i *really* don't wan't to spend the next two days writing a script containing all the tables in the db. -- John Horton DBA Cognito (Informix on Linux) john.horton@cognito.co.uk sysadmin and mahjongg player
No, but here's a quick script that I just wrote that should generate a script
that should do the job.
--------------------------------------------------------
DATABASE=$1
shift
SRV=""
while [ $# -gt 0 ]
do SRV=${SRV}$1" "
shift
done
echo "select tabname from systables where tabid > 99 order by 1;" |
dbaccess $DATABASE 2>/dev/null | \\
nawk -v SRV="${SRV}" -v DB=${DATABASE} 'BEGIN {
split (SRV,SRVARR)
}
{ if ($1 = "tabname" && $2 != "" )
{ printf("cdr define repl rep_%s ", $2)
for (S in SRVARR)
{ printf("\\\\\\n")
printf("\\"%s@%s:informix.%s\\" ", DB, SRVARR[S], $2)
printf("\\"select * from %s\\" ", $2)
}
printf("\\n\\n")
printf("cdr start repl rep_%s\\n\\n", $2)
}
}'