A lot of databases have been learned for a long time, but instances (routines) and databases are often confused. This may be the sequent of college education.
First of all, what is the database? Databases are used to store data for a long time, and we all know that the memory can only be used for temporary storage, and disks can only be used to actually store data. What do you mean the database will be stored there? It must be stored on the disk. In fact, the database is a file on the disk. from the above we draw a conclusion: the database = files on the disk. since the database can be viewed as a file on the disk, how can we use the database? If we can directly use the database, it is equivalent to directly using files on the disk. we know that the files on the disk must be read into the memory before they can be used. this is against a common sense we have known before. should the correct process be like this? Read the files on the disk into the memory before using it. By the way, this is the correct process for using the database. How can the database read the memory? At this time, we will introduce the instance (instance. the instance is the memory structure and a group of background processes. in fact, the normal process of reading a database into the memory is that a group of background processes in the instance read data files from the disk into the memory of the instance, then, data operations are performed in the memory, and a group of background processes are written to the database from the instance memory. the instance should be the running environment of the database, relative to the database ). after we know the difference between instance and database. the following is an oracle example. I have a deep understanding of these two concepts. open a database in Oracle. At this time, we need to use sqlplus. sqlplus is a connection tool of Oracle, which is equivalent to the query analyzer in SQL Server. use Username: system password: manger (set when oracle is installed) to log on to sqlplus. after logging on to sqlplus, the System user does not have the permission to start the instance, so we need to change the login user. run the following command to connect to the Sys User: conn sys as DBA password: after entering the password. you can run the following command to view the current user: Show user; 1: You can open the database. 1. start instance startup nomount2. load the database to instance alter database mount3. Open Database alter database open 2: Close Database: 1. shutdown immediate (three steps are described as follows: first shut down the database, then detach the database from the instance, and finally shut down the instance using Oracle to open and shut down a database. We can clearly differentiate the example. database and instance concepts.