DB2 administrators can use ________ to gather real-time information about database activity.
- Database snapshots
- Event monitors
- Log files
- SQL queries
DB2 administrators can utilize event monitors to gather real-time information about database activity. Event monitors capture events such as SQL statements, locks, and database changes, providing valuable insights into system performance and user behavior. This data can be used for performance tuning, troubleshooting, and auditing purposes.
Scenario: A DBA needs to find the average salary of all employees in a department. Which aggregation function should they use in DB2, and why?
- AVG()
- SUM()
- COUNT()
- MAX()
The correct option is AVG(). AVG() is used to calculate the average of a set of values. In this scenario, the DBA needs to find the average salary, which requires calculating the mean of all salaries in the department. SUM() calculates the total sum of values, COUNT() counts the number of rows, and MAX() returns the maximum value.
Scenario: A DBA needs to grant access to a specific table in DB2 to a new user while ensuring the least privilege principle. How should they approach this task?
- Grant SELECT permission on the specific table to the new user.
- Grant ALL privileges on the specific table to the new user.
- Grant INSERT, UPDATE, and DELETE privileges on the specific table to the new user.
- Grant EXECUTE privilege on the specific table to the new user.
The correct option is to grant SELECT permission on the specific table to the new user. This adheres to the least privilege principle, ensuring that the user only has the necessary access required for their tasks without granting unnecessary privileges. Granting ALL privileges or excessive permissions increases the risk of unintended data manipulation or security breaches.
Which type of subquery returns a single value and can be used within expressions or conditions in SQL statements?
- Correlated subquery
- Derived subquery
- Nested subquery
- Scalar subquery
A scalar subquery in DB2 returns a single value and can be used within expressions or conditions in SQL statements. This makes scalar subqueries versatile and commonly used in various scenarios.
Which term refers to the process of ensuring continuous access to data in the event of a system failure?
- Data replication
- Disaster recovery
- High availability
- Load balancing
High availability refers to the process of ensuring continuous access to data and services even in the event of a system failure. This involves measures such as redundancy, failover mechanisms, and clustering to minimize downtime and maintain uninterrupted access to critical resources.
The WITH ________ clause ensures that any data modification through the view meets specified criteria.
- CHECK
- CONSTRAINT
- REFRESH
- UPDATE
The WITH CONSTRAINT clause ensures that any data modification through the view meets specified criteria, such as enforcing referential integrity.
How can denormalization lead to potential data inconsistency issues?
- Enhanced data integrity
- Increased data redundancy
- Reduced storage requirements
- Simplified data retrieval
Denormalization can lead to potential data inconsistency issues due to increased data redundancy. When redundant data is stored across multiple tables, there is a risk that updates, inserts, or deletes may result in inconsistencies if the redundant data is not properly synchronized. For instance, if a piece of redundant data is updated in one place but not in another, it can lead to inconsistencies between the related data. Thus, while denormalization can improve query performance, it requires careful management to maintain data consistency.
How does JDBC aid in connecting Java applications with DB2?
- Enables communication between PHP scripts and DB2 databases
- Facilitates integration of DB2 with Microsoft applications
- Provides a set of APIs for Java applications to interact with DB2 databases
- Simplifies the process of connecting to DB2 from various applications
JDBC (Java Database Connectivity) is a Java API that provides a set of classes and interfaces for Java applications to interact with various databases, including DB2. It allows Java applications to establish connections to DB2 databases, execute SQL queries, and process the results. JDBC provides a standardized way for Java applications to access databases, making it easier for developers to write portable database applications. By using JDBC, Java developers can leverage the features and capabilities of DB2 in their applications without needing to write platform-specific code.
What is the primary goal of performance tuning in DB2?
- Enhancing query execution speed
- Increasing CPU usage
- Maximizing disk space
- Optimizing database design
Performance tuning in DB2 aims to enhance query execution speed by optimizing various aspects such as indexes, database design, and configuration parameters to improve overall system performance.
Which type of constraint in DB2 ensures data integrity by enforcing uniqueness?
- Primary Key
- Foreign Key
- Check Constraint
- Unique Constraint
A Unique Constraint in DB2 ensures data integrity by enforcing uniqueness in a specific column or combination of columns, ensuring that each value in the column(s) is unique across the table. This constraint prevents duplicate entries, ensuring data accuracy and consistency. Therefore, the correct option is a Unique Constraint. Primary Key also enforces uniqueness but additionally implies uniqueness and not nullity, making Unique Constraint a more general answer for ensuring uniqueness.