CUSTOMER_CODE SMUDE DIVISION_CODE SMUDE EVENT_CODE SMUAPR15 ASSESSMENT_CODE BT0075_SMUAPR15 QUESTION_TYPE DESCRIPTIVE_QUESTION QUESTION_ID 6393 QUESTION_TEXT Describe Log File Maintenance . SCHEME OF EVALUATION MySQL Server can create a number of different log files that make it easy to see what is going on. However, you must clean up these files regularly to ensure that the logs do not take up too much disk space. When using MySQL with logging enabled, you may want to backup and remove old log files from time to time and tell MySQL to start logging new files. On a Linux (Red Hat) installation, you can see the mysql-log-rotate script for this. If you installed MySQL from an RPM distribution, this script should have been installed automatically. You should be careful with this script if you are using a binary log or replication. You should not remove binary logs until you are certain that their contents have been processed by all slaves. On other systems, you must install a short script yourself that you start from cron (or its equivalent) for handling log files. For the binary log you can set the expire_logs_days system variable to expire binary log files automatically after a given number of days. If you are using replication, you should set the variable no lower than the maximum number of days your slaves might tag behind the master. You can force MySQL to start using new log files by issuing a FLUSH LOGS statement or executing mysqladmin flush-logs or mysqladmin refresh. (3 Marks) A log flushing operation does the following: 1.If general query logging or slow query logging to a log file is enabled, the server closes and reopens the general query log file or slow query log file. 2.If binary logging is enabled, the server closes the current binary log file and opens a new log file with the next sequence number. 3.If the server was given an error log filename with the –log-error option, it renames the error log with the suffix –odd and creates a new empty error log file. (3 Marks) The server creates a new binary log file when you flush the logs. However, it just closes and reopens the general and slow query log files. To cause new files to be created on Unix, rename the current logs before flushing them. At flush time, the server will open new logs with the original names. For example, if the general and slow query logs are named mysql.log and mysql-slow.log you can use a series of commands like this: shell> cd mysql-data-directory shell> mv mysql.log mysql.old shell> mv mysql-slow.log mysql-slow.old shell>mysqladmin flush-logs At this point, you can make a back of mysql.old and mysql-slow.log and then remove from the disk. (2 Marks) Before 5.1.3 you cannot remove a log file on Windows while a server has it open. You must stop the server and rename the file and then restart the server to create a new log file. As of 5.1.3, this applies only to the error log. However, a stop and restart can be avoided by using FLUSH LOGS, which causes the server to rename the error log with an –old suffix and open a new error log. As of MySQL 5.1.2, you can disable the general query log or slow query log at runtime. SET GLOBAL general_log = ‘OFF’; SET GLOBAL slow_query_log = ‘OFF’; With logs disabled, rename the log files externally, for example, from the command line. Then enable the logs again: SET GLOBAL general_log = ‘ON’; SET GLOBAL slow_query_log = ‘ON’; This method works on any platform and does not require a server restart. (2 Marks) QUESTION_TYPE DESCRIPTIVE_QUESTION QUESTION_ID 73282 QUESTION_TEXT Describe various logical operators in MySQL. The NOT operator The OR operator SCHEME OF EVALUATION The XOR operator Bit operator Explanation(2.5 each) QUESTION_T DESCRIPTIVE_QUESTION YPE QUESTION_I D 115895 Write and explain the syntax of QUESTION_T a. EXT DROP TABLE b. DROP INDEX c. a) DROP DATABASE DROP TABLE: (04 marks) DROP [TEMPORARY] TABLE [IF EXISTS] tbl_name [, tbl_name] ... [RESTRICT | CASCADE] * DROP TABLE removes one or more tables. * You must have the DROP privilege for each table. * All table data and the table definition are removed. * If any of the tables named in the argument list do not exist, MySQL returns an error indicating by name which non existing tables it was unable to drop, but it also drops all of the tables in the list that do exist. SCHEME OF EVALUATIO N * DROP TABLEautomatically commits the current active transaction, unless you use theTEMPORARY keyword. The TEMPORARY keyword has the following effects: * The statement drops only TEMPORARY tables. * The statement does not end an ongoing transaction. * No access rights are checked b)DROP INDEX: (02 marks) DROP INDEX index_name ON tbl_name DROP INDEX drops the index named index_name from the table tbl_name. This statement is mapped to an ALTER TABLE statement to drop the index. Example: Mysql>DROP INDEX usrname on sysusers; c) DROP DATABASE: (04 marks) DROP {DATABASE | SCHEMA} [IF EXISTS] db_name * DROP DATABASE drops all tables in the database and deletes the database. * To use DROP DATABASE, you need the DROP privilege on the database. * DROP SCHEMA is a synonym for DROP DATABASE. When a database is dropped, user privileges on the database are not automatically dropped. * IF EXISTS is used to prevent an error from occurring if the database does not exist. * If you use DROP DATABASE on a symbolically linked database, both the link and the original database are deleted. * DROP DATABASE returns the number of tables that were removed. This corresponds to the number of .frm files removed. * The DROP DATABASE statement removes from the given database directory those files and directories that MySQL itself may create during normal operation: All files with the following extensions. QUESTION_TYPE DESCRIPTIVE_QUESTION QUESTION_ID 115897 Explain the following in detail a. Error Log b. General Query Log c. Binary Log d. Slow Query Log a) Error Log: QUESTION_TEXT ( 2.5 MARKS) * The error log contains information indicating when mysqld was started and stopped and also any critical errors that occurs while the server is running. * If mysqld notices a table that needs to be automatically checked or repaired,it writes a message to error log. SCHEME OF EVALUATION b) The General Query Log: ( 2.5 MARKS) * It is a general record of what mysqld is doing. * The server writes information to this log when client connect or disconnect, and it logs each SQL statement received from clients. * It is useful when you suspect an error in a client and want to know exactly what the clients sent to mysqld. c) The Binary Log: ( 2.5 MARKS) * All the information that update data. * It also contains statements that potentially could have updated it, unless row-based logging is used. * Statements are stored in the form of “events” that describe the modifications. * It also contains information about how long each statement took that updated data. d) The Slow Query log: ( 2.5 MARKS) * It consists of all statements that took more than long-querytime seconds to execute and required at least min_examined_row_limit rows to be examined. * The time to acquire the initial table locks is not counted as execution time. QUESTION_TYPE DESCRIPTIVE_QUESTION QUESTION_ID 115898 What are the reasons to use MySQL? What is new in MySQL 5.1? QUESTION_TEXT The reasons to use MySQL: [Any 5. 1 Mark Each. 5 x 1 Mark = 5 Marks] SCHEME OF EVALUATION 1. Scalability and Flexibility:The MySQL database server provides the ultimate in scalability, sporting the capacity to handle deeply embedded applications with a footprint of only 1MB to run massive data warehouses holding terabytes of information. Platform flexibility is a stalwart feature of MySQL with all flavors of Linux, UNIX, and Windows being supported. 2. High Performance: A unique storage-engine architecture allows database professionals to configure the MySQL to database server specifically for particular applications, with the end result being amazing performance results. 3. High Availability: MySQL offers a variety of high-availability options from high-speed master/slave replication configurations, to specialized Cluster servers offering instant failover, to third party vendors offering unique high-availability solutions for the MySQL database server. 4. Robust Transactional Support:MySQL offers one of the most powerful transactional database engines on the market. Full data integrity is also assured through server-enforced referential integrity, specialized transaction isolation levels, and instant deadlock detection. 5. Web and Data Warehouse Strengths:MSQL is the de-facto standard for high-traffic web sites because of its high-performance query engine, tremendously fast data inserts capability, and strong support for specialized web functions like fast full text searches. 6. Strong Data Protection:Because guarding the data assets of corporations is the number one job of database professionals, MySQL offers exceptional security features that ensure absolute data protection. 7. Comprehensive Application Development:MySQL also provides connectors and drivers (ODBC, JDBC, etc.) that allow all forms of applications to make use of MYSQL as a preferred data management server. 8. Management Ease:MySQL provides a complete suite of graphical management and migration tools that allow a DBA to manage, troubleshoot, and control the operation of many SQL servers from a single workstation. 9. Open Source Freedom and 24x7 Support:MySQL is not a typical open source project as all the software is owned and supported by MySQL AB, and because of this, a unique cost and support model are available that provides a unique combination of open source freedom and trusted software with support. 10. Lowest Total Cost of Ownership:By migrating current databasedrive applications to MySQL, or using MySQL for new development projects, corporations are realizing cost savings that many times stretch into seven figures. (5 Marks) New in MySQL 5.1: The following features have been added to MySQL 5.1 [Any 5. 1 Mark Each. 5 x 1 Mark = 5 Marks] 1. Partitioning:This capability enables distributing portions of individual labels across a file system, according to rules which can be set when the table is created. In effect, different portions of a table are stored as separate tables in different locations, but from the user point of view, the partitioned table is still a single table. 2. Row-Based Replication: Replication capabilities in MySQL originally were based on propagation of SQL statements from master to slave. This is called statement-based replication. As of MySQL 5.1.5 another basis for replication is available. This is called rowbased replication, instead of sending SQL statements to the slave, the master writes events to its binary log that indicate how individual table rows are affected. As of MySQL 5.1.8 a third options is available; mixed. This will use statement-based replication by default, and only switch to row-based replication in particular cases. 3. Plugin API: MySQL adds support for a very flexible plugin API that enables loading and unloading of various components at runtime, without restarting the server. This allows users to implement their own input filter on the indexed text, enabling full-text search capability on arbitrary data such as PDF files or other document formats. 4. Event Scheduler: MySQL events are tasks that run according to a schedule. When you create an event, you are creating a named database object containing one or more SQL statements to be executed at one or more regular intervals, beginning and ending at a specific date and time. 5. Server Log Tables: As of MySQL 5.1, the server’s logging capabilities are more flexible. Log entries can be written to log files or to the general_logand slow_log tables in the MySQL databases. If logging is enabled, either or both destinations can be selected. The – log-output option controls the destination or destinations of log output. 6. Upgrade Program: The MySQL_upgrade program checks all existing tables for incompatibilities with the current version of MySQL Server and repairs them if necessary. This program should be run for each MySQL upgrade. 7. MySQL Cluster: Clustering support is longer available in mainline MySQL 5.1 releases. MySQL cluster releases are identified by a 3-part NDT version number; currently, the MySQL Cluster NDB 6.2 and MySQL. Cluster NDB 6.3 release series are available for production use. (5 Marks) QUESTION_TYPE DESCRIPTIVE_QUESTION QUESTION_ID 115902 QUESTION_TEXT Describe different storage engines. i. Archive ii. CSV SCHEME OF EVALUATION iii. Example iv. Federated v. Heap