How to create trigger on database that 'triggers' when mirroring role changes from mirror to principal
Create an event notification for the Database Mirroring State Change. See Implementing Event Notifications for how to design a service that processes the notification and does whatever is appropriate. Keep in mind that event notifications are asynchronous.