Clone Database via Enterprise Manager 13c

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome back guys and in this video we are going to understand how do we clone an existing oracle database using the oracle enterprise manager if you remember while we were looking at managing the oracle instance we had an option of cloning the database yes we are going to use that option to clone the dev db database onto another server so guys i mean i have like these three servers the first server is our oem server if you remember this is where our oem server is up and running this is the second server which is our dev server that is acting as the target to the oem server the oem server ip address ends with 171 dev server ip address ends with 172 and right now i have another server on i mean this is another server i have in my network so what i've done is i just connected to the server this is 173 and it's a qa server so before we can actually clone the dev db database which is running on this server we can check psiphon afcrep p1 so this dev db database is already a target of oem server before we can clone the dev db onto the qa server using the oracle enterprise manager first we need to add this qa server to the oracle enterprise manager as a target because this server is new and first of all even before you can clone the dev db onto the server we have to make sure this is also part of the oem server that means this server must also act as a target which is already added to the oem server if the target is not added definitely oem will not identify the qr server and cloning will not happen so before we can add okay i mean our first step is to add the qa server to the oracle enterprise manager right so before we start what you have to do is we have to make sure we are adding the ip addresses of all the servers under the etc host file on all the servers right so for example i'll open the etc host file so i'm editing the edc host file on the oem server so on this server i have the details of the oem server the dev server and now i'm adding the details of the qa server the new server that i am going to add as a target to the oem server so 173 that is qa.dbh nss.com qa so let us save this all right and i'm adding the same details under the dev server so 192 168 1.1 73 qa dot dbhnss.com i think the spelling is correct i'll save this and we have this third server let's open the etc host file okay so we have only one entry now we have to add both the entries for the oem server and for the dev server so oem server entry why we need because we want to add the qr server as a target onto the oem and why are we i mean why do we need to add the dev server entries is because dev server must be able to talk to this server so that cloning goes on smoothly so that's the reason like you have to add it up so 192 168 1.171 that is oem.dbhnss.com [Music] that is oem server and then the next one is 1.172 that is the dev.dbhnss.com this is the dev server right all right so we have added the entries of all the servers under the etc host of all the servers right so each server knows about the other server so our first step is done our next step is like we need to add this qa server to our oracle enterprise manager as a linux target so what is the best way to do it so we'll go to our support website and if you remember we have an article on how to add linux target right can you see add linux target to oem by a pull method we are not going to use the pull method but we are going to use add linux target to oracle enterprise manager cloud control 13c so we don't have to run through all the steps because already one database and listener is running over here let us check can you see there is a qadb a database which is already running on the server so i mean we don't need to recreate a database we just need to add the server for monitoring so let me just show you guys what do i mean so i'm on to the oracle enterprise manager if you go to all targets over here if you just type qa can you see this qr server is not added for monitoring so my goal right now is first add the server for monitoring and later on will perform the cloning so right now to add this qos server onto the monitoring we don't need to install the oracle 12c release tool because it is already installed make sure you make changes to the edc host file which we have just not done em install oracle 12 cr2 pre-installed not required but these packages are important so install below packages as they are required by oem to install agent on this target machine so i'll quickly run these on the qa server awesome once the packages are installed our next step is actually to create this agent directory because this is where the agent software will be installed so what i'll do is i'll create this with the oracle user because any which ways oracle user has to own this directory all right so this is done and i think pretty much we don't need to run the response file because already database is running we need to edit the batch profile and we need to make sure we are adding this agent home so guys these steps you can use on any target if you want to add the target to the oracle enterprise manager for monitoring purpose where already a database and listener are running so this is the agent location i'll add this one will execute the batch profile once again just to have that agent variable ready and i think pretty much that's it we don't need to create a database listener is i mean we don't need to create the listener also add linux target to oem now this is important step so before we can add linux target we must add the target details to etc host file on the oem server which we have already done if you remember our first step was to add these entries to etc host file right can you see the qa server details are added to the oem server now guys why we are doing it because we don't have a dns server in our local setup but in real time you will have the dns servers and if you have dns servers you don't need to edit the dc host file automatically the ip address and the host names will be resolved from the dns server so this is just an extra step for our local setup now to add this qr server as a target onto the oem we need to log into the oem console go to setup and add target add targets manually click on install agent on host now click on add give the host as qa.dbageness.com platform will be linux x 86 64-bit click on next over here installation directory you know it is actually you have to give the installation directory only to agent and delete all this u01 app oracle agent that's the directory agent instance directory will be slash agent underscore instance name credentials i will add name credentials for the server so what are the name credentials these are the credentials for the oracle user that owns the oracle installation i think the password is correct and anytime you're giving the name credentials always use good naming conventions qa underscore oracle underscore user right so that's a good naming convention and what i'll do is i'll also give the root credentials because i know the root user id and password in real time you would not know it but that's okay all right so this is done as i say always give good naming conventions root underscore user and then click on ok that's done delete anything that you see over here all right we are ready to deploy the agent click on next and click on deploy agent so this will start adding the qr server for monitoring purpose on our oem awesome guys we can see that the qa server is added to the oem and our goal is to now discover the database and the listener which is running on the qr server so we'll go to specify the host and over here we'll select the qr server because we want to discover the database and listener on the qr server click on next so this is discovering the all the targets on this qr server awesome on the qadb i mean this is the database which is running so the user the monitoring user will always be dbsnmp by default this user is locked and the password is expired so what we need to do is we need to actually unlock the user so sql plus slash ssdba let us look at inv crepara that's qadb all right sql plus slashes says pba so alter user db snmp account unlock and identified by oracle awesome that's i mean i'm using oracle as the password so i'll give the monitoring password as oracle i want to also monitor the listener which is running on the server uh you can click on test con i mean text oh sorry test the connection yep so the connection is successful click on next and now oem is ready to monitor the qa database and the listener which is running on the qr server so guys till now what we have done is i mean this part is when i mean you'll use this only when the cloning server is not added to your oem server but in case if you have already cloning server i mean the target server where you want to clone if it is already added on to the oracle enterprise manager then directly you can start from the cloning steps which we are going to see right now you can see the qa server is being discovered so we will wait for some time and then once all the qa targets are discovered we will start the cloning process awesome guys so it took 15 minutes for all the targets to be discovered and now we can see all the targets are up and running now see guys this is the beauty if your source and the target servers are already listed on oracle enterprise manager so that means in our case the qadb right now the qa server and the dev server both are now being monitored by the oracle enterprise manager so going forward understand how simple the steps are for cloning like just couple of steps and the cloning will be done right so in our case the problem we had was the qa server was not being monitored by the oracle enterprise manager so that's why we had to first add this as a target to our oracle enterprise manager and then only we were able to i mean we will be able to perform the cloning now guys before we perform the cloning the thing is on the cuba server i have limited ram because i think i have attached the qs over like 4gb ram so what i'll do is first i will bring down the existing database that is running so i'm using the oem from oem itself i can bring down the database so right click on qadb oracle database control startup and shutdown so we want to shut down the instance so that when we perform the cloning the new instance has the available 4gb ram otherwise the cloning will fail so if you have more ram on the target server definitely we don't have to shut down the existing databases which are running but just in case this is test environment so i need to accommodate the new instance so over here the host credentials qa underscore oracle user so i'll go with the name credentials under the like database credentials we did not save any database credentials so what i have to do is i have to connect the server i mean the oracle database with the sys user give the password for this user click on test and the test must be successful click on ok now oem will allow you to shut down this database so i'll go ahead and shut down this database so what i'm doing is on the qa server i'm shutting down the qa database so that we can clone the database from the dev db database to the qa server all right we can see the qadb is down so now we are ready for the cloning as i said guys in your case let's take in your environment the target server has enough ram so you can proceed with the activity right now we are going to see the actual cloning steps so our goal is to clone the dev database which is running on the dev server onto the qa server right so now we have both the servers both the servers are being monitored by the oracle enterprise manager on the qr server the qa database is down because we don't have enough ram over there so if we clone the cloning will fail so what we are going to do is on the dev like the database instance just right click on the dev instance go to oracle database go to cloning and choose the option create full clone we want to create a full clone of the dev database as it is right now so it is like active database cloning live so how i mean whatever data we have on the dev db database right now we want to clone it on to the target server all right over here you have two sites the source database is the dev db the type is single instance database the version is 1201 since dba database credentials by default it will pick up the preferred credentials else you can click over here and give the different credentials if you want to but as i always say setting up preferred credentials in oracle enterprise manager is very important it simplifies your life now date time series do you want to clone it right now or you want to go to point in time so pointed time is definitely oracle will i mean oracle enterprise manager will look for some previous backups and then it will start applying the archive blocks onto the target server but right now we don't have any backups for the dev db so i'll go for the like current live database cloning this is where you got to put the destination details so what is the display name so what i'll do is i will just delete this i'll put dev db underscore qa dot dba genesis.com and dev db underscore qa is the global database name and i'll put the dev db as the database s id so the global database name i think we can change it like dev db i'll put it as dot keyword or dbhn ss.com so that defines that dev db which is running on the qr server that's the global database name and the database sid is dev db the type i want to create a single instance database of course you can even copy the single instance database to rack or rack one node but right now we don't have the asm setup or the grid setup so we cannot go for the rack setup now on the host we need to give the oracle home location so if you choose this option by default it will list all the oracle homes you have to select the oracle home which is on the qa server alright so you make sure you select the keyword or dbagenesis.com this is oracle database 12 home right select this one and the next host make sure it is the qa dot dbgenesis.com the server where the cloning will be performed database host credentials make sure you have the qa dot oracle user because we are connecting to the server as the oracle user click on ok now we'll click on next and guys one more thing you got to make sure your source database that is the dev the one that you're trying to clone all right it is actually running in archive log mode so over here i'll just check i think it has to be in archive log mode archive block list because if it is not in archive log mode definitely the cloning will fail all right so give the okay so the second part is the configuration so database file location so on the target server once the cloning is done where do you want to put your files the data files the temp files redo log files and the control files on the target server i want to put it under u01 slash db underscore files so if you have different location you guys put your location so in my case this is the location where i want to put all the db files control file temp files after the cloning is done right and fra location in my case under the qa server this is the fra location so i'm just giving the fra location under u01 so whatever fra location you have on the q a server you got to put that location over here so guys you might also choose to do something like this so you want to like in your case if it is like slash oracle slash you can give the database sid that is the uh dev tb and then you create this location on the qos server so otherwise if the location is not created the cloning will fail so in my case i have this location already ready so db and risk of files so i'm using these location the fra size i'm going with 8gb the default one the listener configuration you got to make sure you are seeing the listener which is already running on the qr server don't worry oem will automatically pick it up because it was already set to monitor the database credentials what passwords you want to give for this system dbsnmp so i'll just give something over here all right parallelism do you want to increase the armament speed like over here it is grayed out but in your case if you have more number of cpus armin i mean oem will allow you to increase the degree of parallelism so that the cloning speed will be faster these are the initialization parameters guys in case you plan to edit any of the initialization parameters you can do it over here but right now at this point of time i i choose not to change these parameters for simplicity purpose so i'll click on next over here you have post processing do you want to run any custom scripts post processing like this is pre script right prescript is the script that you want to run before the cloning starts postscript is like any script that you want to run after the cloning is done and is there any sql script that you want to run inside the target database or the clone database so once the cloning is done do you want to run any sql script inside the clone database right we don't have any of these options i'll just click on next schedule do you want to clone it right now or do you want to schedule it later now this is the beauty guys many a times in real time what happens is on every saturday midnight your manager will ask you to perform the cloning from production database to the target database or the test database right so you can schedule the cloning by default you don't need to sit in front of the system so you can schedule it on saturday over here like i can choose on 16th i want the cloning should happen at the midnight right i can like change the time whatever time it is and then right so the beauty about this is like exactly on saturday at midnight time any which ways we are cloning from the live database so whatever production data we have on the production database it will be cloned onto the target database automatically even though you're not sitting in front of the system that's the beauty but right now we don't have time for saturday so we'll go for immediately we want to perform the cloning right now click on next this is your review screen you have the source dev db this is the host it is running on the dev server oracle home location and other details i mean all this is not important the right side is very important the destination the display name is dev db underscore keyword or dbgenesis.com global database name is dev db dot keyword or dbgensis.com because it is running on the qa server i am keeping the sid same right dev db dev db single instance database the host should be different make sure source host and the target host are different over here we have these parameters right guys in this one make sure you're creating these two directories the adam location so we got to create this on the qos server so mkdir hyphen p and we have to also create the c dump location these two are important i mean just create these directories else your cloning might fail right and we got to clone it immediately simply click on clone awesome now oem is set to perform the cloning it is actually preparing your target server for the clone so you can refresh the screen and you can see the clone new database this is actually running this is the one that is currently running and over here you can see these all steps are skipped because we are not using those options so all these steps are skipped clone new database click on this option we can see keyword or dbgenesis.com click on this one and this step is skipped create new profile execute pre database remember the pre database scripts we don't have any script so we are skipping this one clone the database this is running so i'll click on this option initialize deployment procedure this is done prepare database clone job this is also done create duplicate database we can see this is running so i'll click on this one and prepare target list this is skipped and clone database this is running i'll click on this one and we can see dev db this is being cloned i'll click on this one again clone database so this is the exact job right now running if you click on this option i mean this check box on the left hand side over here you will see what exactly is happening within that particular step can you see cloud database this step is right now over here and you can scroll and see what exactly is going on inside the database so i believe like once if we have done everything fine so we just have to wait for some time for oem to complete all these steps once these steps are completed our database cloning will be done awesome guys you can see on the left hand side the clone database step is completed and next it proceeded on to execute the post database scripts open user accounts so these all are skipped steps because we didn't configure it post data source creation this is completed and as i said if you want to check what happened on this step click on this option over here and the oem will show you on the right hand side specifically about this step so i think it will open up as a new tab over here we'll wait for it to open up meanwhile you can read create new profile all these are skipped and the last one is important what oem is doing is now that the cloning is done the same clone database is now being added to the oem as a target for monitoring purpose so that's what you can see at target clone properties right the this pop-up now over here popular target properties it actually means that the target clone database the database which is cloned onto the qa server that is now added for monitoring also and we can see that our entire cloning is completed you can see the exact time it took is like 22 minutes for cloning and status you can see has succeeded now what we'll do is we'll go to our qa server and we will check if the cloning was successful or not so pa psyphon af grab pmon we can see we see a dev db database is running on the server perfect so we'll export the oracle underscore sid to dev db sql plus slash assist dba select name comma open underscore mode from v dollar database can you see guys we performed a database cloning from the dev server this is where the dev db is already up and running right onto the qa server and this is the database perfect and this was done as the live database cloning right i'll exit awesome so guys what we have seen in this entire activity what we did is we had a completely new server which was not being monitored by the oracle enterprise manager that is our queue server we added the qr server for monitoring onto the oracle enterprise manager and later on we started the cloning process the cloning process with oracle enterprise manager is very simple it is only six steps that you need to perform within the oem once you follow those six steps automatically cloning will be done once again i'll walk you through the closing steps so let's take if you want to clone the dev db right click go to oracle database cloning choose the option create full clone over here you define the source and the destination next you define the configuration initialization parameters post processing schedule and review i think six steps that allows you to perform the cloning simple straight forward one thing you need to remember is always make sure both the servers like the source and the target servers must be monitored by oracle enterprise manager in order to perform the cloning else let's take you want to clone the dev db database onto a server which is not being monitored by the oracle enterprise manager then you have to follow the traditional method that being said guys i would like to give you an assignment i would like to challenge you what you can do is try to create a destination server in your practice try to create a destination server like with good ram probably like around 10 gb ram try to install the grid and also set up the asm later on come to the screen perform the cloning of the dev db database to a rack database right so this is your assignment when you get free time try to perform this assignment meanwhile i will see you all in the next video
Info
Channel: DBA Genesis
Views: 1,435
Rating: undefined out of 5
Keywords: oracle database, database administration, dba
Id: DV1SegJZuis
Channel Id: undefined
Length: 30min 52sec (1852 seconds)
Published: Sat May 15 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.