nerdexam
Oracle

1Z0-908 · Question #54

Binary log events for the mydb1' schema must be copied to a different schema name mydb2'. Which command will do this?

The correct answer is D. mysqlbinlog --read-from-remote-server --raw | sed `s/mydb1/mydb2/g' | mysql. Important note: The marked answer (D) appears to be incorrect - this question likely has an answer key error. Option A is actually the correct answer. The --rewrite-db='mydb1->mydb2' option is the documented MySQL way to rewrite a schema name when replaying binary logs; the…

Replication

Question

Binary log events for the mydb1' schema must be copied to a different schema name mydb2'. Which command will do this?

Options

  • Amysqlbinlog --rewrite-db='mydb1->mydb2' | mysql
  • Bmysqlbinlog --datebase=mydb1 --database=mydb2 | mysql
  • Cmysqlbinlog --rewrite-db='mydb1' --rewrite-db='mydb2' | mysql
  • Dmysqlbinlog --read-from-remote-server --raw | sed `s/mydb1/mydb2/g' | mysql

How the community answered

(49 responses)
  • A
    10% (5)
  • B
    18% (9)
  • C
    4% (2)
  • D
    67% (33)

Explanation

Important note: The marked answer (D) appears to be incorrect - this question likely has an answer key error.

Option A is actually the correct answer. The --rewrite-db='mydb1->mydb2' option is the documented MySQL way to rewrite a schema name when replaying binary logs; the arrow syntax (from->to) within a single option tells mysqlbinlog to translate all mydb1 references to mydb2 before the events are applied.

Option D is unreliable and arguably wrong: --raw outputs binary (not text) format, making sed substitution on the stream dangerous - it can corrupt binary data by accidentally replacing byte sequences that happen to match the schema name string.

Option B is wrong on two counts: --datebase is a typo, and even the correct --database flag only filters events to a single schema - it does not rename it.

Option C misuses --rewrite-db by providing source and target as separate flags with no arrow; the option requires both names joined with -> in a single value.

Memory tip: Think of --rewrite-db as a redirect - the arrow -> visually shows data flowing from the old name to the new one, just like a redirect operator in shell scripting.

If this is from a practice exam or certification prep material, flag it: the answer key should say A, not D.

Topics

#binary logs#mysqlbinlog#schema rewriting#replication

Community Discussion

No community discussion yet for this question.

Full 1Z0-908 Practice