You are on page 1of 22

Date:23-7-2020

.
Practical No 2: Part A

1. Aim: How to download and install My SQL on Windows 10 Operating


System, Startup and shutdown process of database.
Case- Study-02

On

My SQL Installation

Prerequisite: Oracle ,MySql.

Outcome: Understanding how Setup and configure Oracle/MySql on Windows.

Part B

O/P: Your Case Study

Note: After installation ,Show the process of Database Creation and Creating Table
in the created database.
Name:KHUSHI JAIN

Class: BTech IT

Roll No: A218

INSTALLATION : MySQL

Step 1:  Go to the https://dev.mysql.com/downloads/installer/  and scroll down. Then you will see an option to
choose the Operating System. Here I will choose Windows.

Step 2 : After that, you will see two options to Download. If you have internet connectivity then you can go forward and choose
the mysql-installer-web-community, else you can choose the other one.
Step 3 :  Once, you click on Download, you will be redirected to the following page

Just click on the option of “No thanks, just start my download.” Once, you click on this option, you will see that MySQL
Installer is getting downloaded.

Step 4 : After MySQL Installer gets downloaded, double click on it, and you will see that the MySQL installer Community is
getting installed. Once, it is downloaded you will see the following screen.

In the above dialog box, just check in in the radio button and accept the License Agreement. After that, click on Next.

Step 5 : In the next wizard, you have to choose the setup type. Basically, this is where you choose which features you wish to
install. Here I will choose the option Full and click on Next.
Step 6 : Once you click on Next, you might see that some features may fail to install due to lack of requirements. So, either you
can resolve them, or can skip them, by clicking on Next. Here I will click on Next.

Next, you will see a dialog box asking for your confirmation of a few products not getting installed. So, you can just click
on Yes. Refer below.
As soon as you click on Next, you will see the list of the products which will get installed. So, if you are fine with the products,
go ahead and click on Execute as below.
Server Configuration : Next, you have to configure the Server and Router. Well, over here let me tell you that, I am not going
to configure the Router now since it is not required to simply use MySQL. But, I will show you how to configure Server. So, in
the below dialog box, click on Next.

Step 7 : In the below wizard, you can either choose the Standalone MySQL Replication or the InnoDB Cluster based on
your requirement. Here I will choose, Standalone MySQL Cluster and then click on Next.
Step 8 : Once, you click on Next, you have to mention the server configuration. So, I will leave it as it is and then click
on Next.

Step 9 : Now, you have to choose the authentication method. Here, I will choose the first option and click on Next. Refer below.
Step 10 : Next, you have to mention the MySQL Root Password and again click on Next.

Step 11 : Finally, you have to choose whether you want to start the server or not. Here, I am going to leave it as it is. Then, click
on Next.
Now, the wizard will give you a list of the configurations which will be applied. So, if you agree with the configuration click
on Execute.

Once the execution is done, click on Finish. This will finish the configuration of Server .
Step 12 :  In the next wizard that comes up, you can choose to configure the Router. So just click on Next and click on Finish.

Step 13 : Once, you click on Finish, you will see the following wizard, to Connect to server. Here mention the root password,
which you had set in the previous steps. 
Step 14 :  Once, you click on Next, choose the configurations applied and click on Execute.

After the configurations get applied, you will see the following screen. So, here just click on Finish.
Step 15 :  Now, to check whether MySQL is installed or not, you can open the MySQL Shell and mention the root password .
INSTALLATION: Oracle Database
Step 1 : Click on the https://www.oracle.com/database/technologies/oracle-database-software-
downloads.html to download.

Step 2 : The installer asks you to provide your email address to get the latest security issues and
updates. You can ignore it by clicking the Next button.
Step 2. In step 2, Oracle installer ask you to whether you want to create and configure a database,
install database software only or just upgrade an existing database. Because you install the Oracle
database at the first time, choose the option 1 and click the Next button.

Step 3. The installer allows you to choose the system class. Because you install Oracle on your
computer, not a server, therefore, you choose the first option: desktop class and click the Next button.
Step 4.  This step allows you to specify the Windows user account to install and configure Oracle
Home for enhanced security. Choose the third option: “Use Windows Built-in Account”.

Step 5. in this step you can (1) choose the folder on which Oracle database will be installed, (2) Global
database name and password, (3) pluggable database name .
Step 6. The installer performs the prerequisite check.

Step 7.  The installer shows you the summary of the information such as global settings, database
information, etc. You need to review the information and click the install button if everything is fine.
Step 8. The installer starts installing Oracle database. It will take a few minutes to complete,
depending on your computer.
You will see the Database Configuration Assistant window. Click the Password management… button
to enter the password for Oracle database accounts.
Enter the password for SYS and SYSTEM accounts and then click OK button.

Step 9. Once installation completes successfully, the installer will inform you as shown in the following
screenshot. Click the Close button to close the window.
STARTUP AND SHUTDOWN PROCESS : ORACLE DATABASE

Startup   
There are various stages which the database undergoes before a database is opened for use.

No-mount State:
This is the state when the control file, online redo log files and the database files are closed and
are not accessible. The oracle instance is available. Some of the v$ views (dynamic performance
views) are available during this state.

A database may be brought to this state to perform operations like.

1. Creating database.
2. Recreating control file.
Ex: V$session, v$instance, v$database etc.
Mount state:
This is the next phase through which the database passes. During this stage, the control file is
opened and the existence of all the database files and online redo log files is verified.

A database may be brought to this state to perform operations like

1. Backup
2. Recovery of the system or undo data file

When you query v$database for the open_mode, we get the answer as mounted.  

Open:
The database is opened. During this stage, the datafiles and the online redo log files are opened
and are ready to use. Oracle doesn’t allow you to open the database if any of the datafile or
online redo log file is missing or is corrupted.

A database may be opened is read only mode as well as in read write mode. The status may be
found by querying v$database dynamic performance view. The query for this is as below

Sql>select open_mode from v$database:

In the read only mode, the database may be queried but one cannot perform the dml operations.
Shutdown
Oracle has three shutdown modes namely normal, immediate and abort.

1. Shutdown normal: This is the default mode of shutting down the database. During this state,
oracle server waits for all the users to disconnect.
2. Shutdown Transactional: Waits until all the transactions are completed and then shts down
the database. During this state, no new connections are permitted.
3. Shutdown immediate: This option will disconnect all the sessions; roll back all the running
transactions and shutdown the datababase. During the next startup no instance recovery is
needed.
4. Shutdown abort: This option doesn’t rollback any transactions and simply brings down the
database. In layman’s term, it just likes pulling the power plug of the television. Any subsequent
database startup needs an instance recovery to be initiated by smon.
Any backup taken after shutting down the database in abort mode will not be consistent. It is
recommended to use the first three methods to shutdown the database for a consistent backup.

STARTUP AND SHUTDOWN PROCESS : MySQL


To start the server, enter this command:

C:\> "C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld" –console

For a server that includes InnoDB support, you should see the messages similar to those
following as it starts

1. InnoDB: The first specified datafile c:\ibdata\ibdata1 did not exist:


2. InnoDB: a new database to be created!
3. InnoDB: Setting file c:\ibdata\ibdata1 size to 209715200
4. InnoDB: Database physically writes the file full: wait...
5. InnoDB: Log file c:\iblogs\ib_logfile0 did not exist: new to be created
6. InnoDB: Setting log file c:\iblogs\ib_logfile0 size to 31457280
7. InnoDB: Log file c:\iblogs\ib_logfile1 did not exist: new to be created
8. InnoDB: Setting log file c:\iblogs\ib_logfile1 size to 31457280
9. InnoDB: Log file c:\iblogs\ib_logfile2 did not exist: new to be created
10. InnoDB: Setting log file c:\iblogs\ib_logfile2 size to 31457280
11. InnoDB: Doublewrite buffer not found: creating new
12. InnoDB: Doublewrite buffer created
13. InnoDB: creating foreign key constraint system tables
14. InnoDB: foreign key constraint system tables created
15. 011024 10:58:25 InnoDB: Started

When the server finishes its startup sequence, you should see something like this, which
indicates that the server is ready to service client connections:

mysqld: ready for connections


Version: '5.7.32' socket: '' port: 3306
The server shutdown process takes place as follows:

1. The shutdown process is initiated.

This can occur initiated several ways. For example, a user with the SHUTDOWN privilege can
execute a mysqladmin shutdown command. mysqladmin can be used on any platform
supported by MySQL. Other operating system-specific shutdown initiation methods are
possible as well: The server shuts down on Unix when it receives a SIGTERM signal. A
server running as a service on Windows shuts down when the services manager tells it to.
2. The server creates a shutdown thread if necessary.

Depending on how shutdown was initiated, the server might create a thread to handle the
shutdown process. If shutdown was requested by a client, a shutdown thread is created. If
shutdown is the result of receiving a SIGTERM signal, the signal thread might handle
shutdown itself, or it might create a separate thread to do so. If the server tries to create a
shutdown thread and cannot (for example, if memory is exhausted), it issues a diagnostic
message that appears in the error log:
Error: Can't create thread to kill server

1. The server stops accepting new connections.

To prevent new activity from being initiated during shutdown, the server stops accepting
new client connections by closing the handlers for the network interfaces to which it
normally listens for connections: the TCP/IP port, the Unix socket file, the Windows named
pipe, and shared memory on Windows.

2. The server terminates current activity.

For each thread associated with a client connection, the server breaks the connection to the
client and marks the thread as killed. Threads die when they notice that they are so marked.
Threads for idle connections die quickly. Threads that currently are processing statements
check their state periodically and take longer to die. For additional information about thread
termination, see KILL Statement, in particular for the instructions about killed REPAIR
TABLE or OPTIMIZE TABLE operations on MyISAM tables.
For threads that have an open transaction, the transaction is rolled back. If a thread is
updating a nontransactional table, an operation such as a multiple-
row UPDATE or INSERT may leave the table partially updated because the operation can
terminate before completion.
If the server is a master replication server, it treats threads associated with currently
connected slaves like other client threads. That is, each one is marked as killed and exits
when it next checks its state.

If the server is a slave replication server, it stops the I/O and SQL threads, if they are active,
before marking client threads as killed. The SQL thread is permitted to finish its current
statement (to avoid causing replication problems), and then stops. If the SQL thread is in the
middle of a transaction at this point, the server waits until the current replication event group
(if any) has finished executing, or until the user issues a KILL QUERY or KILL
CONNECTION statement. See also STOP SLAVE Statement. Since nontransactional
statements cannot be rolled back, in order to guarantee crash-safe replication, only
transactional tables should be used.
1. The server shuts down or closes storage engines.

At this stage, the server flushes the table cache and closes all open tables.

Each storage engine performs any actions necessary for tables that it
manages. InnoDB flushes its buffer pool to disk (unless innodb_fast_shutdown is 2),
writes the current LSN to the tablespace, and terminates its own internal
threads. MyISAM flushes any pending index writes for a table.
2. The server exits.

To provide information to management processes, the server returns one of the exit codes
described in the following list. The phrase in parentheses indicates the action taken by systemd
in response to the code, for platforms on which systemd is used to manage the server.

 0 = successful termination (no restart done)


 1 = unsuccessful termination (no restart done)
 2 = unsuccessful termination (restart done)

You might also like